-
Notifications
You must be signed in to change notification settings - Fork 319
Postgres adapter: Allow fields in json_extract_path #660
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
Postgres adapter: Allow fields in json_extract_path #660
Conversation
Actually I did miss something. I've only tested with with edit: added to the Ecto PR |
@josevalim After looking into it closer, MySQL is a bit more awkward than postgres. It doesn't have a syntax for just plopping in the field reference. You have to use their It seems like a waste to use If that sounds like an ok direction to explore, would it be alright if I send a follow up PR shortly and merge this one as is? |
Maybe we don't have to do it in Ecto actually. We can probably figure it out in the adapter. |
that's what I was thinking. those are static paths anyway, they are not meant to be very long. |
@josevalim Sorry for all the back and forth. So there is another complication. In MySQL you need to know whether you are taking about an integer or string because the syntax is different between them: I think it will need some careful thinking whether we can find a sane way to do it for MySQL. Do you mind if I just merge the postgres stuff? |
We are completely fine with adding database specific functionality, as long as we raise for the other adapters that don't actually support it. :) Go for it! |
Closes #646
Companion Ecto PR: elixir-ecto/ecto#4604
I'm pretty sure we can do this. I've shown how it can be accomplished with Postgres in this PR. I left out MySQL for now for a few reasons..mainly because I am tired, but also because if I'm making a horrible mistake then I want to save some wasted effort.
If no one can see a reason why this is bad, I can add the MySQL stuff!