fsprojects / fsprojects/FSharp.Data.SqlClient
SqlProgrammability provider fails to update/bulk copy into tables with computed persistent columns
Nobody has claimed this yet.
- Dominant language
- F#
- Stars
- 206
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
Description
SqlProgrammability provider fails to update/bulk copy into tables with computed persistent columns - you get exception when you call update method:
System.Data.NoNullAllowedException: Column '{persistentColumn}' does not allow nulls.
Repro steps
Please provide the steps required to reproduce the problem
- Create table:
CREATE TABLE [dbo].[T1](
[A] [int] NOT NULL,
B AS ((0)) PERSISTED NOT NULL
)
- Step B
type Database = SqlProgrammabilityProvider<"name=someConnectionString">
let t = new Database.dbo.Tables.T1()
t.AddRow(3)
t.Update()
Expected behavior
New row is inserted into the table.
Actual behavior
System.Data.NoNullAllowedException: Column 'B' does not allow nulls.
Known workarounds
Following code can be used - works for update only:
let t = new Database.dbo.Tables.T1()
let r = t.NewRow(3)
r.["B"] <- 0
t.Rows.Add(r)
t.Update()
Related information
.Net Standard 4.6.2
SqlServer 2016
SqlClient 1.8.1
Contributor guide
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.
Research direction
Start with the SqlProgrammability provider's generated table and row update paths, using the supplied T1 schema and AddRow/Update reproduction. Compare the update and bulk-copy flows, then verify that inserts into tables with computed persistent columns complete without a NoNullAllowedException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp, sql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100