OnConflict implementation for SQLite provider uses wrong feature of SQLite
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- fsharp, sqlite
- Bereich
- databases
Rechercherichtung
Der Issue nennt keine Dateien oder Tests; beginne damit, die aktuelle OnConflict-Implementierung des SQLite-Providers zu lokalisieren, und lies die verlinkte SQLite-Dokumentation zu ON CONFLICT und UPSERT. Vergleiche das Verhalten mit anderen unterstützten Providern und dem gemeldeten NOT NULL-Fall. Erledigt ist die Aufgabe, wenn das gewählte SQLite-Verhalten oder dessen dokumentierter Warnhinweis abgestimmt und implementiert ist und die Abwärtskompatibilität berücksichtigt wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- F#
- Sterne
- 627
- Forks
- 147
- Ø Merge
- 2 Std. 2 Min.
- Gemergte PRs (30 T.)
- 1
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus fsprojects/SQLProvider
-
enhancement
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
fsprojects/SQLProvider#872 · 2 Kommentare ·
-
Repo Assist? Offenenhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 10/100
fsprojects/SQLProvider#870 · 1 Kommentar ·
-
postgresql
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 58/100
fsprojects/SQLProvider#869 · 2 Kommentare ·
-
documentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 42/100
fsprojects/SQLProvider#868 · 2 Kommentare ·
-
sql server
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
fsprojects/SQLProvider#851 · 1 Kommentar ·
Alle Issues in fsprojects/SQLProvider
Ähnliche Issues
-
[Documentation Request] vLLM kv_load_failure_policy doesn't apply to load failures in L2 adapters Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
-
DATABASE_URL=pglite:memory: creates a directory named 'memory:' instead of an in-memory database Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
BuilderIO/agent-native#5730 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
duckdb/duckdb-wasm#2258 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
supabase/agent-skills#602 ·