OnConflict implementation for SQLite provider uses wrong feature of SQLite
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- fsharp, sqlite
- 領域
- databases
研究方向
該 issue 沒有列出檔案或測試;首先定位 SQLite provider 目前的 OnConflict 實作,並閱讀連結的 SQLite ON CONFLICT 與 UPSERT 文件。將其行為與其他受支援 provider 的行為以及回報的 NOT NULL 情況進行比較。當選定的 SQLite 行為或其文件化的警告取得共識並完成實作,同時考量向後相容性時,即視為完成。
由索引模型根據 Issue 內容生成。
描述
Describe the bug
I think that implementation of OnConflict uses wrong feature of SQLite.
If you check the SQLite docs mentioned in https://fsprojects.github.io/SQLProvider/core/crud.html#OnConflict you'll see that "ON CONFLICT clause applies to UNIQUE, NOT NULL, CHECK, and PRIMARY KEY constraints".
SQLite has another feature, specifically for UPSERTs - https://sqlite.org/lang_upsert.html . Docs for that feature mention that "UPSERT in SQLite follows the syntax established by PostgreSQL, with generalizations."
I don't know why this feature of SQLite was chosen back in the day. Even though ON CONFLICT was available in SQLite for decades and UPSERT was only added at 2018, when this feature was added to SQLProvider UPSERT had already been available.
Nevertheless, I think it's quite confusing. Behavior of this feature for SQLite is different from other supported providers. I suppose we have two options:
- Fix SQLProvider implementation to use proper UPSERTS for SQLite, probably adding a configuration toggle somewhere to enable backward compatibility.
- Add a warning to the docs stating that usage of OnConflict feature for SQLite has a broader scope than one could expect.
In my case, I set OnConflict.Ignore to one of my tables, expecting it to only deal with primary key violations.
In the meantime, I had an error in my app, one of the non-null column hasn't been filled, but SQLite hasn't complained about it and just silently refused to insert a row into a table. At the end, by debugging raw sql I was able to figure things out.
- 主要語言
- F#
- 星號
- 627
- 分支
- 148
- 平均合併
- 2 小時 2 分鐘
- 30 天內合併 PR
- 1
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
fsprojects/SQLProvider 的其他 Issue
-
enhancement
難度 3/5 1-2 天 新手友好度 55/100
fsprojects/SQLProvider#872 · 2 則留言 ·
-
Repo Assist?未關閉enhancement
難度 5/5 一週以上 新手友好度 10/100
fsprojects/SQLProvider#870 · 1 則留言 ·
-
postgresql
難度 4/5 3-5 天 新手友好度 58/100
fsprojects/SQLProvider#869 · 2 則留言 ·
-
documentation
難度 2/5 1-3 小時 新手友好度 42/100
fsprojects/SQLProvider#868 · 2 則留言 ·
-
sql server
難度 4/5 3-5 天 新手友好度 45/100
fsprojects/SQLProvider#851 · 1 則留言 ·
查看 fsprojects/SQLProvider 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 68/100
Arekkazu/sgpmp-backend#549 ·
維護者通常 1 天內回覆
-
priority: medium tech-debt
難度 2/5 1-3 小時 新手友好度 62/100
LeeAdcock/robocodeJs.com#411 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
good first issue refactor
難度 2/5 1-3 小時 新手友好度 80/100
pedrorchagas/blog-api#18 ·
-
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 2 天內回覆