Skip to content

Cannot insert to tables which have only one column #233

Closed

Description

@asturel

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"

Activity

  1. CezarCretu commented on Aug 4, 2014

    @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"

  2. added this to the milestone on Aug 6, 2014
  3. roji commented on Aug 6, 2014

    @roji
    Member

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

  4. Emill commented on Aug 6, 2014

    @Emill
    Contributor

    It was fixed after rc1 was released?
    Den 6 aug 2014 07:33 skrev "Shay Rojansky" [email protected]:

    @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).

  5. roji commented on Aug 6, 2014

    @roji
    Member

    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

  6. CezarCretu commented on Aug 6, 2014

    @CezarCretu
    Contributor

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

  7. franciscojunior commented on Aug 6, 2014

    @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

  8. roji commented on Aug 6, 2014

    @roji
    Member

    Great!

  9. added theissue type on Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions