René's URL Explorer Experiment


Title: fix(sql): skip TSQL paging for aggregates without @group by lnuxe · Pull Request #885 · APIJSON/APIJSON · GitHub

Open Graph Title: fix(sql): skip TSQL paging for aggregates without @group by lnuxe · Pull Request #885 · APIJSON/APIJSON

X Title: fix(sql): skip TSQL paging for aggregates without @group by lnuxe · Pull Request #885 · APIJSON/APIJSON

Description: 背景 issue #648 反馈:SQL Server 下 @column 用聚合函数会报错。 复现请求: { "Moment": { "@column": "max(date):date" } } 报错: order by 子句列 id 无效,因为该列没有包含在聚合函数或 group by 子句中 原因 SQL Server / DB2 / Kingbase SQL Server 模式下,OFFSET ... FETCH ... 必须带 ORDER BY,所以 gainOrderString 在 getCount() > 0 时自动补上 ORDER BY "id": if (getCount() > 0 && (isSQLServer() || isKingBaseSQLServer() || isDb2())) { ... order = idKey; // 没传 @order 时默认用 id } 但 max(date) 这种不带 GROUP BY 的单聚合永远只返回一行,它没有 id 列可以排序,于是生成非法 SQL: SELECT max("date") AS "date" FROM "sys"."Moment" ORDER BY "id" OFFSET 0 ROWS FETCH FIRST 10 ROWS ONLY MySQL / PostgreSQL 走 LIMIT,不强制 ORDER BY,所以一直是好的——这解释了为什么只有 SQL Server 报。 修复 新增 isAggregateWithoutGroup():@group 为空、@column 只有一项、且该项是 SQL_AGGREGATE_FUNCTION_MAP 里的聚合函数(max/min/avg/count/sum)时返回 true。 两处使用: gainOrderString:这种查询不再补 ORDER BY。 gainLimitString:直接返回空字符串——结果本来就只有一行,OFFSET/FETCH 没有意义。 修复后: SELECT max("date") AS "date" FROM "sys"."Moment" 不受影响的场景 普通字段分页:仍保留 ORDER BY "id" OFFSET 0 ROWS FETCH FIRST 10 ROWS ONLY 带 @group 的聚合:仍保留 ORDER BY(可以按分组字段排序) MySQL / PostgreSQL:LIMIT 分支未改动 测试 新增 AbstractSQLConfigAggregatePagingTest(6 个用例): SQL Server / DB2 / Kingbase SQL Server 的聚合查询断言无 ORDER BY、无 OFFSET SQL Server 普通字段分页断言仍带 ORDER BY + OFFSET SQL Server 带 @group 的聚合断言仍带 ORDER BY 双通道验证 修复前(git checkout origin/main -- src/main/java/apijson/orm/AbstractSQLConfig.java): aggregate paging: SELECT max("date") AS "date" FROM "sys"."Moment" ORDER BY "id" OFFSET 0 ROWS FETCH FIRST 10 ROWS ONLY [ERROR] AbstractSQLConfigAggregatePagingTest.skipsOrderByForSQLServerAggregate:127 聚合函数不带 GROUP BY 时不应补 ORDER BY,否则列不在聚合函数内会报错 [ERROR] Tests run: 6, Failures: 4, Errors: 0, Skipped: 0 修复后: [INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0 -- in apijson.orm.AbstractSQLConfigAggregatePagingTest [INFO] Tests run: 44, Failures: 0, Errors: 0, Skipped: 0 [INFO] BUILD SUCCESS 全量 mvn test 44 个用例全绿(原有 38 + 新增 6),无回归。 fix #648

Open Graph Description: 背景 issue #648 反馈:SQL Server 下 @column 用聚合函数会报错。 复现请求: { "Moment": { "@column": "max(date):date" } } 报错: order by 子句列 id 无效,因为该列没有包含在聚合函数或 group by 子句中 原因 SQL ...

X Description: 背景 issue #648 反馈:SQL Server 下 @column 用聚合函数会报错。 复现请求: { "Moment": { "@column": "max(date):date" } } 报错: order by 子句列 id 无效,因为该列没有包含在聚合函...

Opengraph URL: https://github.com/APIJSON/APIJSON/pull/885

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:0926d03b-ffab-72f6-8942-caa67accda13
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9780:32D5F:FA0BCE:1671586:6AFCB1BA
html-safe-noncebd572ffd9c9b482a073ac8a34ae0461cbead836dfff17cd2cae4bb11321e0fe1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzgwOjMyRDVGOkZBMEJDRToxNjcxNTg2OjZBRkNCMUJBIiwidmlzaXRvcl9pZCI6IjM0MzA1NTcxMzc1MTAzNzk5NjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0199a5a32dc07d2d2c1c63ef7242eb90d48ba08f205cf783f1df97bdd837f8f7
hovercard-subject-tagpull_request:5259197757
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/APIJSON/APIJSON/pull/885/files
twitter:imagehttps://avatars.githubusercontent.com/u/144079529?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/144079529?s=400&v=4
og:image:alt背景 issue #648 反馈:SQL Server 下 @column 用聚合函数会报错。 复现请求: { "Moment": { "@column": "max(date):date" } } 报错: order by 子句列 id 无效,因为该列没有包含在聚合函数或 group by 子句中 原因 SQL ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonee3084aead77cbcb4f4904fba53851fa1a0546b0dec3619bd250815e72588dc6d
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/APIJSON/APIJSON git https://github.com/APIJSON/APIJSON.git
octolytics-dimension-user_id41146037
octolytics-dimension-user_loginAPIJSON
octolytics-dimension-repository_id74359442
octolytics-dimension-repository_nwoAPIJSON/APIJSON
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id74359442
octolytics-dimension-repository_network_root_nwoAPIJSON/APIJSON
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release5410e4bebd3e45b138c853ecef3992279d86d5af
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/APIJSON/APIJSON/pull/885/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FAPIJSON%2FAPIJSON%2Fpull%2F885%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FAPIJSON%2FAPIJSON%2Fpull%2F885%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=APIJSON%2FAPIJSON
Reloadhttps://github.com/APIJSON/APIJSON/pull/885/files
Reloadhttps://github.com/APIJSON/APIJSON/pull/885/files
Reloadhttps://github.com/APIJSON/APIJSON/pull/885/files
APIJSONhttps://github.com/APIJSON
APIJSONhttps://github.com/APIJSON/APIJSON
Codehttps://github.com/APIJSON/APIJSON
Issues237 (237)https://github.com/APIJSON/APIJSON/issues
Pull requestshttps://github.com/APIJSON/APIJSON/pulls
Actionshttps://github.com/APIJSON/APIJSON/actions
Wikihttps://github.com/APIJSON/APIJSON/wiki
Security and qualityhttps://github.com/APIJSON/APIJSON/security
Insightshttps://github.com/APIJSON/APIJSON/insights
Sign up for GitHub https://github.com/signup?return_to=%2FAPIJSON%2FAPIJSON%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FAPIJSON%2FAPIJSON%2Fissues%2Fnew%2Fchoose
TommyLemonhttps://github.com/TommyLemon
APIJSON:mainhttps://github.com/APIJSON/APIJSON/tree/main
lnuxe:fix-aggregate-tsql-paging-cleanhttps://github.com/lnuxe/APIJSON/tree/fix-aggregate-tsql-paging-clean
Conversation 0 https://github.com/APIJSON/APIJSON/pull/885
Commits 1 https://github.com/APIJSON/APIJSON/pull/885/commits
Checks 1 https://github.com/APIJSON/APIJSON/pull/885/checks
Files changed https://github.com/APIJSON/APIJSON/pull/885/files
Please reload this pagehttps://github.com/APIJSON/APIJSON/pull/885/files
fix(sql): skip TSQL paging for aggregates without @group https://github.com/APIJSON/APIJSON/pull/885/files#top
Show all changes 1 commit https://github.com/APIJSON/APIJSON/pull/885/files
c4da9e9 fix(sql): skip TSQL paging for aggregates without @group lnuxe Nov 11, 2026 https://github.com/APIJSON/APIJSON/pull/885/commits/c4da9e9f2fe6691fe1ce48e1d9ccc63dab46a479
Clear filters https://github.com/APIJSON/APIJSON/pull/885/files
Please reload this pagehttps://github.com/APIJSON/APIJSON/pull/885/files
Please reload this pagehttps://github.com/APIJSON/APIJSON/pull/885/files
AbstractSQLConfig.java https://github.com/APIJSON/APIJSON/pull/885/files#diff-122a62fcb6d18967f07dfc450569028e0705dfabe001a05e4ce57cdab134e16d
AbstractSQLConfigAggregatePagingTest.java https://github.com/APIJSON/APIJSON/pull/885/files#diff-b77ec8cfcaf0aec393128e504d4c34b0667dde7a2e27cef106a78321c8ca2d1c
src/main/java/apijson/orm/AbstractSQLConfig.javahttps://github.com/APIJSON/APIJSON/pull/885/files#diff-122a62fcb6d18967f07dfc450569028e0705dfabe001a05e4ce57cdab134e16d
View file https://github.com/lnuxe/APIJSON/blob/c4da9e9f2fe6691fe1ce48e1d9ccc63dab46a479/src/main/java/apijson/orm/AbstractSQLConfig.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/APIJSON/APIJSON/pull/885/{{ revealButtonHref }}
https://github.com/APIJSON/APIJSON/pull/885/files#diff-122a62fcb6d18967f07dfc450569028e0705dfabe001a05e4ce57cdab134e16d
https://github.com/APIJSON/APIJSON/pull/885/files#diff-122a62fcb6d18967f07dfc450569028e0705dfabe001a05e4ce57cdab134e16d
https://github.com/APIJSON/APIJSON/pull/885/files#diff-122a62fcb6d18967f07dfc450569028e0705dfabe001a05e4ce57cdab134e16d
https://github.com/APIJSON/APIJSON/pull/885/files#diff-122a62fcb6d18967f07dfc450569028e0705dfabe001a05e4ce57cdab134e16d
https://github.com/APIJSON/APIJSON/pull/885/files#diff-122a62fcb6d18967f07dfc450569028e0705dfabe001a05e4ce57cdab134e16d
src/test/java/apijson/orm/AbstractSQLConfigAggregatePagingTest.javahttps://github.com/APIJSON/APIJSON/pull/885/files#diff-b77ec8cfcaf0aec393128e504d4c34b0667dde7a2e27cef106a78321c8ca2d1c
View file https://github.com/lnuxe/APIJSON/blob/c4da9e9f2fe6691fe1ce48e1d9ccc63dab46a479/src/test/java/apijson/orm/AbstractSQLConfigAggregatePagingTest.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/APIJSON/APIJSON/pull/885/{{ revealButtonHref }}
Please reload this pagehttps://github.com/APIJSON/APIJSON/pull/885/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.