ramsql icon indicating copy to clipboard operation
ramsql copied to clipboard

Deadlock while using named arguments

Open perceeg opened this issue 3 years ago • 1 comments

While following a slight deviation to the example on https://pkg.go.dev/database/sql, I encountered a deadlock. For example,

example.go

package myproject

import (
    "database/sql"

    _ "github.com/proullon/ramsql/driver"
)

db, _ := sql.Open("ramsql", ":inmemory:")
defer db.Close()

var name string

// sql: expected 0 arguments, got 1
db.QueryRowContext(context.TODO(), "select p.name from people as p where p.id = :id;", sql.Named("id", "1234")).Scan(&name) 

// deadlock 🤔
db.ExecContext(context.TODO(), "INSERT INTO people (id,name) VALUES (?,?)", "1234", "Ramone")

go.mod

module github.com/myorg/myproject

go 1.17

require github.com/proullon/ramsql v0.0.0-20211120092837-c8d0a408b939

perceeg avatar Dec 11 '21 04:12 perceeg

Thanks for the report, I'll take a look

proullon avatar Dec 11 '21 14:12 proullon