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

Regression with Option[Record] results in 1.0.0-RC6 #2144

Open
Jasper-M opened this issue Nov 21, 2024 · 2 comments
Open

Regression with Option[Record] results in 1.0.0-RC6 #2144

Jasper-M opened this issue Nov 21, 2024 · 2 comments

Comments

@Jasper-M
Copy link

Jasper-M commented Nov 21, 2024

I experienced a regression in the latest 1.0.0-RC6. I don't yet have a fully tested self contained example though.
But I think it boils down to this code:

case class Foo(a: Int, b: String)
case class Bar(c: Int, d: Option[String])

sql"SELECT a, b, c, d FROM foo LEFT JOIN bar ON a = c".query[(Foo, Option[Bar])]

With these records in the DB:

| a | b     |
-------------
| 1 | 'abc' |
| c | d    |
------------
| 1 | NULL |

I used to get (Foo(1, "abc"), Some(Bar(1, None))) as the result of that query, and now I get (Foo(1, "abc"), None).

@jatcwang
Copy link
Collaborator

jatcwang commented Nov 21, 2024

Thanks for the report. I believe this is a long running issue in doobie and should be fixed by #2136.

See the changes I made for the test scenario "Read should read correct columns for instances with Option (None)" in ReadSuite.scala. I believe in RC5 the behaviour works for your case but not in the general case.

I'll add more tests to verify that left joining a table with not-null and null columns are handled correctly.

@Jasper-M
Copy link
Author

I believe in RC5 the behaviour works for your case but not in the general case.

Up until 1.0.0-RC5 I didn't notice issues with it. But I also haven't used that feature prolifically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants