mirror of
https://github.com/jackc/pgx.git
synced 2025-05-31 11:42:24 +00:00
fix panic in prepared sql
This commit is contained in:
parent
4678e69599
commit
319c3172f2
@ -35,6 +35,11 @@ func (q *Query) Sanitize(args ...any) (string, error) {
|
|||||||
str = part
|
str = part
|
||||||
case int:
|
case int:
|
||||||
argIdx := part - 1
|
argIdx := part - 1
|
||||||
|
|
||||||
|
if argIdx < 0 {
|
||||||
|
return "", fmt.Errorf("first sql argument must be > 0")
|
||||||
|
}
|
||||||
|
|
||||||
if argIdx >= len(args) {
|
if argIdx >= len(args) {
|
||||||
return "", fmt.Errorf("insufficient arguments")
|
return "", fmt.Errorf("insufficient arguments")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user