diff --git a/db/db.go b/db/db.go index 0a47719d0..b976e3e4b 100644 --- a/db/db.go +++ b/db/db.go @@ -111,7 +111,7 @@ func get(ctx context.Context, db *sql.DB, query string, args ...interface{}) (st func buildGetCondition(fields map[string]string) (string, error) { for column, field := range fields { if field != "" { - return fmt.Sprintf("%s = '%s'", column, field), nil + return fmt.Sprintf("%s = %s", pq.QuoteIdentifier(column), pq.QuoteLiteral(field)), nil } } return "", errors.New("one GetBy field must be set to build a get condition")