Skip to content

iOS: plugin-backed engines drop allowed values and GENERATED ALWAYS identity #4422

Done

Description

@datlechin

What happened?

On iOS, every engine that runs the Mac plugin (SQLite, DuckDB, ClickHouse, Oracle, Cloudflare D1, MongoDB) maps the plugin's columns through ColumnInfo(from:), which copies neither allowedValues nor a GENERATED ALWAYS identity. Two results:

  • ClickHouse Enum8 and Enum16 columns get no value completion after WHERE status = . The Mac offers the labels.
  • An Oracle GENERATED ALWAYS AS IDENTITY column reads as writable. Insert Row shows a field for it instead of "Assigned by the database", and a non-key one can be edited in the row detail. Oracle refuses both (ORA-32795, ORA-32796). The Mac treats the column as server-owned.

Steps to reproduce

ClickHouse:

  1. CREATE TABLE t (id UInt32, status Enum8('new' = 1, 'paid' = 2)) ENGINE = MergeTree ORDER BY id
  2. On iPhone or iPad, type SELECT * FROM t WHERE status = in the query editor.
  3. No values are offered.

Oracle:

  1. CREATE TABLE t (id NUMBER PRIMARY KEY, seq NUMBER GENERATED ALWAYS AS IDENTITY, note VARCHAR2(40))
  2. On iOS, open T and a row. SEQ is editable. Change it and save: ORA-32796.

Expected behavior

ColumnInfo(from:) carries allowedValues, and identityKind == .always sets rejectsWrittenValues, as the iOS SQL Server driver does for identity columns.

Code path

  • apple/Packages/TableProCore/Sources/TableProModels/QueryResult.swift:312-325 sets neither field.
  • apple/TableProMobile/TableProMobile/Drivers/PluginBackedDriver.swift:239-243 maps every plugin column through it.
  • ClickHouse fills allowedValues from the Enum type (apple/Plugins/ClickHouseDriverPlugin/ClickHousePluginDriver+Schema.swift:103). The iOS completion fallback only parses ENUM(...) and SET(...) spellings (apple/TableProMobile/TableProMobile/Completion/QueryCompletionCatalog.swift:214-226).
  • Oracle reports .always (apple/Plugins/OracleDriverPlugin/OraclePluginValues.swift:42, :57-63). iOS gates edits and inserts on isServerOwned (ViewModels/RowDetailViewModel.swift:228-237, Views/InsertRowView.swift:125, Helpers/RowInserter.swift:72). iOS SQL Server sets it (Drivers/MSSQLDriver.swift:458); the Mac reads .always as server-owned (apple/TablePro/Core/Services/Query/QueryExecutor.swift:420).
  • OracleBackedDriverTests "Identity and virtual columns read as auto-increment and generated" checks isAutoIncrement only.

Found by reading the code at main, not run on a device.

Database type

ClickHouse, Oracle

TablePro version

main (f67b55a)

Platform

iPhone / iPad (iOS / iPadOS)

Found during the 2026-11-22 perf audit.

Activity

  1. added
    bug
    platform-ios
    on Nov 23, 2026
  2. mvanhorn commented on Nov 25, 2026

    @mvanhorn
    Contributor

    ColumnInfo(from:) dropped the enum labels supplied by the plugin. It also mapped both Oracle identity modes to isAutoIncrement, losing the distinction the forms need to tell whether a column accepts an explicit value.

    The mapping now copies plugin.allowedValues for query completion and sets rejectsWrittenValues only when identityKind is .always. This lets the forms treat always-identity columns as server-owned while keeping by-default identities writable.

    #4494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplatform-ios

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions