Cannot insert to tables which have only one column #233

Closed
asturel opened this Issue May 7, 2014 · 7 comments

Projects

None yet

5 participants

@asturel
asturel commented May 7, 2014

I have a table which have only one column: Id which is the primary key.

type [<Table("Test", Schema = "dbo")>] Test () =
  [<property : PrimaryKey>]
  member val Id   = Unchecked.defaultof<int> with get, set

let e = Test()
let o = store.Set(typeof<Test>).Add e
store.SaveChanges() |> ignore

generates the following query, which is invalid

INSERT INTO "dbo"."Test"() VALUES () RETURNING "Id"
@CezarCretu
Contributor

Ran into the same issue today on the current version from master.
I believe the proper syntax would be INSERT INTO "schema"."table" VALUES(default) RETURNING "Id"

@Emill Emill closed this in #310 Aug 5, 2014
@franciscojunior franciscojunior added this to the 2.2 milestone Aug 6, 2014
@roji
Member
roji commented Aug 6, 2014

@CezarCretu, @asturel, this bug was fixed. Can you please try our 2.2-rc1 and confirm?

@Emill
Member
Emill commented Aug 6, 2014

It was fixed after rc1 was released?
Den 6 aug 2014 07:33 skrev "Shay Rojansky" notifications@github.com:

@CezarCretu https://github.com/CezarCretu, @asturel
https://github.com/asturel, this bug was fixed. Can you please try our
2.2-rc1 and confirm?


Reply to this email directly or view it on GitHub
#233 (comment).

@roji
Member
roji commented Aug 6, 2014

Sorry, I got confused here... thanks for noticing @Emill.

This fix isn't available yet in any release, although I think it will definitely be included in the final 2.2.

@CezarCretu, @asturel: you can download the binaries for the latest 2.2 branch (where this fix is merged) here: http://build.npgsql.org/viewLog.html?buildId=1849&buildTypeId=npgsql_all&tab=artifacts

@CezarCretu
Contributor

It's fixed in the version you linked, thanks.

@franciscojunior
Member

This fix isn't available yet in any release, although I think it will definitely be included in the final 2.2.

Yep. I already applied this patch to release-2.2.0 branch: 1c6e2d2

@roji
Member
roji commented Aug 6, 2014

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment