GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — fix(sql): skip TSQL paging for aggregates without @group by lnuxe · Pull Request #885 · APIJSON/APIJSON Conversation背景issue #648 反馈:SQL Server 下 复现请求: {
"Moment": {
"@column": "max(date):date"
}
}报错: 原因SQL Server / DB2 / Kingbase SQL Server 模式下, if (getCount() > 0 && (isSQLServer() || isKingBaseSQLServer() || isDb2())) { ... order = idKey; // 没传 @order 时默认用 id } 但 SELECT max("date") AS "date" FROM "sys"."Moment" ORDER BY "id" OFFSET 0 ROWS FETCH FIRST 10 ROWS ONLY MySQL / PostgreSQL 走 修复新增 两处使用:
修复后: SELECT max("date") AS "date" FROM "sys"."Moment" 不受影响的场景
测试新增
双通道验证修复前( 修复后: 全量 fix #648
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsSQL Server and DB2 require ORDER BY for OFFSET FETCH, so gainOrderString injected ORDER BY id for any paginated query. A query whose @column is a single aggregate without @group, such as max(date):date, returns exactly one row and cannot order by a non aggregated column: SELECT max("date") AS "date" FROM "sys"."Moment" ORDER BY "id" OFFSET 0 ROWS FETCH FIRST 10 ROWS ONLY The database rejects it because id is not contained in an aggregate function or a GROUP BY clause, as reported in issue 648. Add isAggregateWithoutGroup, skip the injected ORDER BY for such queries, and return an empty limit string from gainLimitString because the result is a single row anyway. Queries with @group and queries on plain columns keep paging. fix APIJSON#648 This branch has not been deployedNo deployments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. [Bug] sqlserver查询聚合函数出错Uh oh!
There was an error while loading. Please reload this page. 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. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |