sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

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

Open wildwind123 opened this issue 1 year ago • 0 comments

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 ?

wildwind123 avatar May 26 '24 03:05 wildwind123