jmoiron / sqlx

general purpose extensions to golang's database/sql
http://jmoiron.github.io/sqlx/
MIT License
16.3k stars 1.09k forks source link

Mysql "... update nowait" does not return error #926

Open wildwind123 opened 6 months ago

wildwind123 commented 6 months ago

on this mysql query, does not return error, and return empty rows, if query is locked for update

rows, err := sqlx.Query("select id from payment where status in (1, 2) for update nowait;")

should return error like

SQL Error [3572] [HY000]: Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set.

but error is return on QueryRow

row := sqlx.QueryRow("select id from payment where status in (1, 2) for update nowait;")

    var id int

    err = row.Scan(&id)
    if err != nil {
        t.Error(err)
    }

how make get err on sqlx.Query ?