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

MySQL Delete doesn't work when combined with Where ... in (?) #699

Closed
Tracked by #770
grantzvolsky opened this issue Apr 4, 2022 · 1 comment · Fixed by #784
Closed
Tracked by #770

MySQL Delete doesn't work when combined with Where ... in (?) #699

grantzvolsky opened this issue Apr 4, 2022 · 1 comment · Fixed by #784
Assignees
Labels
bug Something isn't working f: sql about SQL support s: fixed was fixed or solution offered
Milestone

Comments

@grantzvolsky
Copy link
Contributor

grantzvolsky commented Apr 4, 2022

Description

Suppose the query

err = tx.RawQuery("DELETE FROM songs WHERE id in (?)", []uuid.UUID{u1.ID, u3.ID}).Exec()

This works fine, but we'd like to use Pop instead of RawQuery. So we write

ids := []uuid.UUID{u1.ID, u3.ID}
err = tx.Where("id in (?)", ids).Delete(&Song{})

This works with all dialects except for MySQL. With MySQL, we get

mysql delete: sql: converting argument $2 type: unsupported type []string, a slice of string

Steps to Reproduce the Problem

pushd $(mktemp -d)
git clone --depth 10 [email protected]:grantzvolsky/pop.git -b issue/mysql-query-slice-delete
cd pop
make release-test

Expected Behavior

Provided testcase doesn't fail.

Actual Behavior

Provided testcase fails whith MySQL; works with other dialects.

Workarounds

ids := []uuid.UUID{u1.ID, u3.ID}
iids := make([]interface{}, len(ids))
for i, v := range ids {
	iids[i] = v
}
err = tx.Where("id in (?)", iids...).Delete(&Song{})

Info

OS: Linux 5.13.0-37-generic
Pop: 32f6994 [development] feat: support embedded struct fields (#691)

grantzvolsky added a commit to ory/hydra that referenced this issue May 19, 2022
- Add a workaround for [mysql slice delete](gobuffalo/pop#699)
- Optimize logout verification (save 1 db rountrip)
- Update a test to use StaticContextualizer & revert CleanAndMigrate workaround
- Ensure a Client generated with faker satisfies the DB schema
- Remove unused argument from HandleConsentRequest
aeneasr pushed a commit to ory/hydra that referenced this issue Jun 27, 2022
- Add a workaround for [mysql slice delete](gobuffalo/pop#699)
- Optimize logout verification (save 1 db rountrip)
- Update a test to use StaticContextualizer & revert CleanAndMigrate workaround
- Ensure a Client generated with faker satisfies the DB schema
- Remove unused argument from HandleConsentRequest
grantzvolsky added a commit to ory/hydra that referenced this issue Aug 1, 2022
- Add a workaround for [mysql slice delete](gobuffalo/pop#699)
- Optimize logout verification (save 1 db rountrip)
- Update a test to use StaticContextualizer & revert CleanAndMigrate workaround
- Ensure a Client generated with faker satisfies the DB schema
- Remove unused argument from HandleConsentRequest
aeneasr pushed a commit to ory/hydra that referenced this issue Aug 1, 2022
- Add a workaround for [mysql slice delete](gobuffalo/pop#699)
- Optimize logout verification (save 1 db rountrip)
- Update a test to use StaticContextualizer & revert CleanAndMigrate workaround
- Ensure a Client generated with faker satisfies the DB schema
- Remove unused argument from HandleConsentRequest
aeneasr pushed a commit to ory/hydra that referenced this issue Aug 18, 2022
- Add a workaround for [mysql slice delete](gobuffalo/pop#699)
- Optimize logout verification (save 1 db rountrip)
- Update a test to use StaticContextualizer & revert CleanAndMigrate workaround
- Ensure a Client generated with faker satisfies the DB schema
- Remove unused argument from HandleConsentRequest
aeneasr pushed a commit to ory/hydra that referenced this issue Sep 5, 2022
- Add a workaround for [mysql slice delete](gobuffalo/pop#699)
- Optimize logout verification (save 1 db rountrip)
- Update a test to use StaticContextualizer & revert CleanAndMigrate workaround
- Ensure a Client generated with faker satisfies the DB schema
- Remove unused argument from HandleConsentRequest
aeneasr pushed a commit to ory/hydra that referenced this issue Sep 7, 2022
- Add a workaround for [mysql slice delete](gobuffalo/pop#699)
- Optimize logout verification (save 1 db rountrip)
- Update a test to use StaticContextualizer & revert CleanAndMigrate workaround
- Ensure a Client generated with faker satisfies the DB schema
- Remove unused argument from HandleConsentRequest
@sio4 sio4 self-assigned this Sep 24, 2022
@sio4 sio4 added bug Something isn't working f: sql about SQL support labels Sep 24, 2022
@sio4 sio4 added this to the v6.0.7 milestone Sep 24, 2022
@sio4
Copy link
Member

sio4 commented Sep 24, 2022

Found the cause of the issue, fixed with PR #784, and will be released as v6.0.7 soon.

@sio4 sio4 closed this as completed in #784 Sep 24, 2022
@sio4 sio4 added the s: fixed was fixed or solution offered label Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working f: sql about SQL support s: fixed was fixed or solution offered
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants