Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RowsAffected not set during INSERT statement match #29

Open
hamersaw opened this issue Aug 25, 2021 · 0 comments
Open

RowsAffected not set during INSERT statement match #29

hamersaw opened this issue Aug 25, 2021 · 0 comments

Comments

@hamersaw
Copy link

I have the following code testing an INSERT. The goal is to simulate a key already exists; which, when specified with 'ON CONFLICT DO NOTHING' returns no error and instead just RowsAffected() on the result returns 0.

GlobalMock := mocket.Catcher.Reset()
GlobalMock.Logging = true
expectedReservation := GetReservation()

GlobalMock.NewMock().WithQuery(
	`INSERT INTO "reservations" ("created_at","updated_at","deleted_at","dataset_project","dataset_name","dataset_domain","dataset_version","tag_name","owner_id","expires_at","serialized_metadata") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11) ON CONFLICT DO NOTHING`,
).WithRowsNum(0)

What I am seeing is that no matter what I change the WithRowsNum() called value to the RowsAffected always returns 1. This same syntax works well in testing an UPDATE command, so it's peculiar that it is not working here. Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant