Getting 'Query: could not match actual sql' on identical queries
z4id opened this issue · 2 comments
z4id commented
Operating system and Go Version
- OS: macOS Ventura 13.0 (22A380)
- System: Macbook Apple M1 Air
- go version: go1.16.15 darwin/arm64 (Tried with go1.18.2 darwin/arm64 & go1.19 darwin/arm64 as well)
- go-sqlmock: v1.5.0
Issue
Getting error "Query: could not match actual sql" even though both strings are identical. (compared via another tool)
rows, err := d.DB.Query(query)
P.S:: Same code is working on other systems. Not sure whether its related to different hardware architecture or OS.
Reproduction steps
SQL query is mocked like this:
mock.ExpectQuery(regexp.QuoteMeta(expectedQuery)).WillReturnRows(rows)
Expected Result
There should be no error.
Actual Result
Query: could not match actual sql:
thecodecafe commented
Hey @z4id were you able to figure this issue out? Experiencing this as well.
See the error I get below.
Query: could not match actual sql:
SELECT * FROM "accounts" WHERE created_at > 1970-01-01 01:00:00 +0100 WAT AND "accounts"."deleted_at" IS NULL ORDER BY created_at DESC LIMIT 100
with expected regexp
SELECT * FROM "accounts" WHERE created_at > 1970-01-01 01:00:00 +0100 WAT AND "accounts"."deleted_at" IS NULL ORDER BY created_at DESC LIMIT 100
thecodecafe commented