Skip to content

fix(plugin-trino): page results with OFFSET before LIMIT#1936

Merged
datlechin merged 1 commit into
mainfrom
fix/trino-pagination-offset-order
Jul 21, 2026
Merged

fix(plugin-trino): page results with OFFSET before LIMIT#1936
datlechin merged 1 commit into
mainfrom
fix/trino-pagination-offset-order

Conversation

@datlechin

Copy link
Copy Markdown
Member

Problem

Clicking a Trino table failed with:

SELECT * FROM "jdbc"."pseudo_columns" LIMIT 1000 OFFSET 0
SYNTAX_ERROR: line 1:50: mismatched input 'OFFSET'. Expecting: <EOF>

Trino's grammar requires OFFSET before LIMIT/FETCH, but TablePro classified Trino's dialect as paginationStyle: .limit, so it emitted the MySQL/Postgres order LIMIT 1000 OFFSET 0. This broke every Trino table browse.

Fix

Reclassify Trino as paginationStyle: .offsetFetch with an empty offsetFetchOrderBy. The .offsetFetch path already emits OFFSET 0 ROWS FETCH NEXT 1000 ROWS ONLY, which Trino accepts and which needs no ORDER BY. The empty offsetFetchOrderBy is a sentinel telling the two ORDER-BY-injection sites to skip the MSSQL-only synthetic ORDER BY (SELECT NULL).

Reusing .offsetFetch keeps this ABI-free. PaginationStyle is @frozen, so a new OFFSET n LIMIT n case would force a PluginKit version bump and a re-release of every registry plugin. No other plugins are touched.

Changes

  • TrinoPlugin.swift and PluginMetadataRegistry+RegistryDefaults.swift: Trino dialect now .offsetFetch with an empty offsetFetchOrderBy.
  • TableQueryBuilder.swift and FilterSQLGenerator.swift: treat an empty offsetFetchOrderBy as "no synthetic ORDER BY".
  • Tests: Trino pages with OFFSET ... FETCH NEXT ... ROWS ONLY and no LIMIT/ORDER BY; MSSQL still injects its default ORDER BY; .limit dialects still emit LIMIT n OFFSET m.
  • Docs and CHANGELOG updated.

Delivery

The dialect in the plugin binary is authoritative at browse time, so users get the fix once the Trino plugin is re-published (plugin-trino-v*, a normal release, no ABI bump). The app-side changes ride the next app release.

Grammar check

Confirmed against the Trino docs: LIMIT n OFFSET m is a syntax error; both OFFSET m LIMIT n and OFFSET m ROWS FETCH NEXT n ROWS ONLY are valid, and neither requires ORDER BY (only FETCH ... WITH TIES does).

https://claude.ai/code/session_01FYwKEwKydeMG6WAHucMdY9

@mintlify

mintlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
TablePro 🟢 Ready View Preview Jul 21, 2026, 3:44 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@datlechin
datlechin merged commit adcf7e3 into main Jul 21, 2026
1 of 2 checks passed
@datlechin
datlechin deleted the fix/trino-pagination-offset-order branch July 21, 2026 15:45
@mintlify

mintlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
TablePro 🟡 Building Jul 21, 2026, 3:44 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

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