Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

OnConflict implementation for SQLite provider uses wrong feature of SQLite

Aberta
#796 3 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
fsharp, sqlite
Domínio
databases

Direção de pesquisa

A issue não menciona arquivos nem testes; comece localizando a implementação atual de OnConflict do provider SQLite e leia a documentação vinculada do SQLite sobre ON CONFLICT e UPSERT. Compare o comportamento com o de outros providers compatíveis e com o caso NOT NULL relatado. A tarefa estará concluída quando o comportamento escolhido do SQLite, ou seu aviso documentado, tiver sido acordado e implementado, considerando a compatibilidade retroativa.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

sqlite

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:

  1. Fix SQLProvider implementation to use proper UPSERTS for SQLite, probably adding a configuration toggle somewhere to enable backward compatibility.
  2. 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.

Linguagem predominante
F#
Estrelas
627
Forks
147
Merge médio
2h 2min
PRs com merge (30d)
1

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de fsprojects/SQLProvider

Todas as issues de fsprojects/SQLProvider

Issues semelhantes

Mais issues de Databases

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.