fix(plugin-trino): page results with OFFSET before LIMIT#1936
Merged
Conversation
datlechin
force-pushed
the
fix/trino-pagination-offset-order
branch
from
July 21, 2026 15:44
4c9bcac to
5157a25
Compare
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
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.
Problem
Clicking a Trino table failed with:
Trino's grammar requires
OFFSETbeforeLIMIT/FETCH, but TablePro classified Trino's dialect aspaginationStyle: .limit, so it emitted the MySQL/Postgres orderLIMIT 1000 OFFSET 0. This broke every Trino table browse.Fix
Reclassify Trino as
paginationStyle: .offsetFetchwith an emptyoffsetFetchOrderBy. The.offsetFetchpath already emitsOFFSET 0 ROWS FETCH NEXT 1000 ROWS ONLY, which Trino accepts and which needs noORDER BY. The emptyoffsetFetchOrderByis a sentinel telling the two ORDER-BY-injection sites to skip the MSSQL-only syntheticORDER BY (SELECT NULL).Reusing
.offsetFetchkeeps this ABI-free.PaginationStyleis@frozen, so a newOFFSET n LIMIT ncase would force a PluginKit version bump and a re-release of every registry plugin. No other plugins are touched.Changes
TrinoPlugin.swiftandPluginMetadataRegistry+RegistryDefaults.swift: Trino dialect now.offsetFetchwith an emptyoffsetFetchOrderBy.TableQueryBuilder.swiftandFilterSQLGenerator.swift: treat an emptyoffsetFetchOrderByas "no synthetic ORDER BY".OFFSET ... FETCH NEXT ... ROWS ONLYand noLIMIT/ORDER BY; MSSQL still injects its default ORDER BY;.limitdialects still emitLIMIT n OFFSET m.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 mis a syntax error; bothOFFSET m LIMIT nandOFFSET m ROWS FETCH NEXT n ROWS ONLYare valid, and neither requiresORDER BY(onlyFETCH ... WITH TIESdoes).https://claude.ai/code/session_01FYwKEwKydeMG6WAHucMdY9