Skip to content

LastInsertId method returns 0? #13

Description

@vendion

I don't know if this driver implements the LastInsertId method of the Result type of the database/sql package or not but when I tried to use it I got back a 0 but in Postgres I could see the last ID was 98.

The way that I tried it out is as follows:

result, err := db.Exec("insert into commands (command,slot) values ($1,$2)", incoming.Command, incoming.Slot)
if err != nil {
    l.Printf("Error inserting into the commands table: %v\n", err)
    return
}

id, _ := result.LastInsertId()
fmt.Println(id) //Prints 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions