fuelen / ecto_dev_logger

An alternative logger for Ecto queries
Apache License 2.0
147 stars 14 forks source link

Comments for numeric enum #30

Open dkuku opened 1 month ago

dkuku commented 1 month ago

First of all - thank you for the great project. I Just faced an issue that also gave me an idea - the generated sql looks like this: sp0."entry_type" = ANY ('{10,11,13}') I think this is from such ecto code: where([sp], sp.entry_type in [:green, :blue, :red]) where the values ar Ecto.Enums First of all it fails for me when executing. Second - could we add a comment after it that points to the actual enum value? sp0."entry_type" = ANY (10,11,13) /* green, blue, red */

fuelen commented 1 month ago

Hi Daniel

First of all it fails for me when executing.

Why does it fail? What error do you see?

Second - could we add a comment after it that points to the actual enum value?

This is an interesting idea. However, It can't be implemented with the current interface of Ecto.DevLogger.PrintableParameter. We have to implement something smarter :)

dkuku commented 1 month ago

Sorry, I think I messed something up because when I retried it now it works. I was thinking it's invalid sql but I just double checked it and it's works.