-
-
Notifications
You must be signed in to change notification settings - Fork 174
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
UPDATE with JOIN for MySQL dialect: Column in field list is ambiguous #344
Comments
I'll have to do some research across multiple databases. This is currently the way it is because at least one database (maybe several) does not allow qualified names in |
Would it be possible to use qualified names just for MySQL for now? My tests show that MySQL 8 supports this. |
As I said, I will do some research across multiple databases and decide on the best solution for this problem because HoneySQL must support a wide variety of databases. My baseline for MySQL support is 5.7. I need to figure out how changing the behavior of |
OK, I'm starting to look into this now and came across #317 which is why qualified keywords have their namespace portion dropped in Then I looked through the tests, figuring I must have a test for #317 and indeed I do: https://github.com/seancorfield/honeysql/blob/develop/test/honey/sql_test.cljc#L353-L375 Interestingly, explicitly dotted names are respected so you could use However, I've gone ahead and modified how qualifiers work in |
Thanks! |
Produces:
MySQL will complain:
The reason is that
deleted_at
needs to be prefixed withsubscriptions
. When I use the following string instead, MySQL accepts it:["UPDATE `subscriptions` INNER JOIN `customers` ON `customers`.`id` = `subscriptions`.`customer_id` SET `subscriptions`.`deleted_at` = ? WHERE (`customers`.`phone` = ?) AND (`customers`.`deleted_at` IS NULL) AND (`subscriptions`.`deleted_at` IS NULL)" now phone-number]
I already tried to enforce this in the code above by namespacing the keyword, but for some reason HoneySQL did not adopt that into the final string.
The text was updated successfully, but these errors were encountered: