-
Notifications
You must be signed in to change notification settings - Fork 17
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
Potential Bug When Joining Same Table to Another Multiple Times #25
Comments
Hi Changlin, HaskellDB is absolutely riddled with bugs and no one seems to be interested in fixing them. However, nowadays there exists a far superior SQL-generating library for Haskell called Opaleye (even if I do say so myself (I'm the author)). If you are using Postgres you will probably find Opaleye more useful for you. It hasn't been designed or tested for any other RDBMS, but it may work with others. https://github.com/tomjaguarpaw/haskell-opaleye Feel free to email me if you have any questions. My contact details are in the README. |
@tomjaguarpaw "absolutely riddled" might be a little strong. @changlinli Sorry I missed your email on the mailing list. Because your first example reuses If you are interested, take a look in the I'd be glad to merge a patch that fixes this. |
@m4dc4p I think "Absolutely riddled" is balanced and reasonable. There are these four critical bugs that make HaskellDB essentially unusable for writing composable queries, and they have gone unaddressed for up to a year and a half. Optimize.hs is a rats nest where bugs could be hiding on every other line, and indeed I have found a few there. It has bitrotted beyond repair. |
@tomjaguarpaw I've been following Opaleye with interest and am very happy that you've been able to get approval to release the code to the community. I'll definitely be using it for at least one personal project at some point. Unfortunately I am using HaskellDB on a project that requires MS SQL and HaskellDB + HDBC-ODBC has been the best solution I've seen so far (although both have been a rather poorly documented road to go down). If you have ideas on how Opaleye could be adapted to fit in a Microsoft environment, I'd be very happy to hear them. To be clear I have gained a good deal of use from HaskellDB and so I'm not convinced that it is beyond repair. Many thanks to @m4dc4p and the other stewards of HaskellDB that have guided it through its life from its beginnings as an academic/student project. It is somewhat unfortunate to learn that this is a bug and not me being dumb. I'll try my best to grok the code and see if I can submit a patch for this particular bug. I may bother you @m4dc4p some more for pointers as I go through the code. I anticipate it'll be quite a while before I understand enough to submit a meaningful patch though. |
I guess you meant |
Yep, that's right. I miswrote the comment. I've edited the original. |
@changlinli I pushed a bug fix branch - still needs some refactoring, but (at least for me) it fixes the issue you described. Check it out: https://github.com/m4dc4p/haskelldb/tree/m4dc4p/25-duplicate-column-failure. Notice I added some test cases in test/TestCases.hs that address the problem:
|
Apologies for the lateness of my reply; things got a bit busy on my end. Unfortunately, it looks like I'm still running into problems, I'll have some examples up when I get time today. |
I already posted this to the mailing list, but I haven't heard back after two weeks, so I'll give GitHub a shot here.
Apologies up front as I'm not the most experienced with SQL or with relational algebra, so maybe I'm doing this completely incorrectly. Nonetheless, I'm getting behavior that doesn't seem to be right. When I (inner) join a table A twice to another table B and SELECT the same column from A in both joins, HaskellDB doesn't differentiate between which column came from the first table and which came from the second.
I've attached a minimum working example (which also has some Haddock documentation that you can run docstring on to verify my comments in the code) which contains comments describing the problem I'm seeing. I apologize for the gigantic spew of code, but HaskellDB usually requires quite a bit of boilerplate code to get all the table definitions.
Just to be clear that it's not the fact that I'm using the same types that are ruining this, if I make entirely new types, it still doesn't work.
The text was updated successfully, but these errors were encountered: