fix(creator): 详情接口用了 MySQL 5.7 不支持的 NULLS LAST
1064 语法错误。nullslast() 是 PostgreSQL 语法,MySQL 5.7 不认;而 MySQL 把 NULL 视为比任何值都小, 所以 DESC 本身就把它排在最后,不需要额外声明。 这个 bug 只在真机上暴露:SQLite 从 3.30 起支持 NULLS LAST,本地测试环境测不出来。
This commit is contained in:
@@ -141,7 +141,10 @@ async def latest_notes(session: AsyncSession, account_id: int) -> List[Dict[str,
|
||||
& (CreatorNoteStat.captured_at == newest.c.captured_at),
|
||||
)
|
||||
.where(CreatorNoteStat.account_id == account_id)
|
||||
.order_by(CreatorNoteStat.publish_time.desc().nullslast())
|
||||
# 不要用 nullslast():那是 PostgreSQL 语法,MySQL 5.7 会直接抛 1064 语法错误。
|
||||
# MySQL 把 NULL 视为比任何值都小,所以 DESC 天然把未解析出发布时间的排在最后。
|
||||
# 这个 bug 只在真机上才暴露 —— SQLite 从 3.30 起支持 NULLS LAST,测试环境测不出来。
|
||||
.order_by(CreatorNoteStat.publish_time.desc())
|
||||
)
|
||||
).all()
|
||||
return [_note_dict(row) for row in rows]
|
||||
|
||||
Reference in New Issue
Block a user