Panic in prepared statesment
maksymnevajdev opened this issue · comments
Describe the bug
If prepared arguments in sql string started with 0 - finish with panic(out of range -1 )
https://github.com/jackc/pgx/blob/master/internal/sanitize/sanitize.go:41
To Reproduce
Select * from table where id = $0
Fix
add
if argIdx < 0 { return "", fmt.Errorf("first sql argument must be > 0") }
in
https://github.com/jackc/pgx/blob/master/internal/sanitize/sanitize.go:38
fix PR #1819
Merged #1819