Allow developers to extend/create their own the OnConflict clause
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- fsharp, postgresql
- Domain
- databases
Research direction
Start at src/SQLProvider.Runtime/Providers.Postgresql.fs around line 516 and inspect the OnConflict discriminated union and its SQL generation. Compare how the other providers handle conflict behavior before deciding the extension's scope. Done means custom ON CONFLICT behavior can address non-primary unique-index conflicts without breaking Throw, Update, or DoNothing.
Written by the indexing model from the issue text.
Description
Is there any way to create / use a custom "ON CONFLICT" clause? It looks like this should be easily extendible by adding another case to the OnConflict discriminated union:
match entity.OnConflict with
| Throw -> ()
| Update ->
~~(sprintf " ON CONFLICT (%s) DO UPDATE SET %s "
(String.Join(",", pk |> List.map (sprintf "\"%s\"")))
(String.Join(",", columnNamesWithValues |> List.map(fun (c,p) -> sprintf "\"%s\" = %s" c p.ParameterName ) )))
| DoNothing ->
~~(sprintf " ON CONFLICT DO NOTHING ")
| Custom clause -> ~~(sprintf clause)
I have a postgres database with tables that contain unique indices that aren't a primary key (created via Rails migrations). I'd like to be able to watch out for conflicts on these columns and update other columns as necessary.
edit
If you think this would be a desired feature, I'd be happy to submit a pull request. I'd need/want your help for other providers but I could at least kick it off.
- Dominant language
- F#
- Stars
- 627
- Forks
- 147
- Avg merge
- 2h 2m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fsprojects/SQLProvider
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 55/100
fsprojects/SQLProvider#872 · 2 comments ·
-
Repo Assist? Openenhancement
Difficulty 5/5 Over a week Newbie friendliness 10/100
fsprojects/SQLProvider#870 · 1 comment ·
-
postgresql
Difficulty 4/5 3-5 days Newbie friendliness 58/100
fsprojects/SQLProvider#869 · 2 comments ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
fsprojects/SQLProvider#868 · 2 comments ·
-
sql server
Difficulty 4/5 3-5 days Newbie friendliness 45/100
fsprojects/SQLProvider#851 · 1 comment ·
All issues in fsprojects/SQLProvider
Similar issues
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
[BUG] A column whose default is the empty string is drawn in the ER diagram as having no default Openbug database-provider good first issue hacktoberfest
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
libredb/libredb-studio#1030 · 6 comments ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug redshift
Difficulty 2/5 1-3 hours Newbie friendliness 88/100