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

Left Join with many fail on null #24

Closed
rkosafo opened this issue Sep 24, 2017 · 3 comments
Closed

Left Join with many fail on null #24

rkosafo opened this issue Sep 24, 2017 · 3 comments
Assignees

Comments

@rkosafo
Copy link
Contributor

rkosafo commented Sep 24, 2017

Given

    ( Id int primary key autoincrement
    , Email string(254) unique
    , Name string(64) null
    );

create table Comments
    ( Id int primary key autoincrement
    , AuthorId int references Users(Id)
    , Comment string(512)
    );

create index IX_Comments_AuthorId on Comments
    (AuthorId);

-- initial data
Insert into Users (email, name)
Values ('a@outlook.com', 'Mr. A'), ('b@gmail.com', 'Mr. B');

Insert into Comments (authorId, comment)
Values (1, 'This is cool'), (1, 'This is not cool');

The code below fails with Data is Null. This method or property cannot be called on Null values.

module Tests =
  let print x = printf "Output: %A" x

  type LeftJoinWithManyFails = SQL<"""
    Select u.id, many comments (c.id, c.comment)
    From Users u
    left Join Comments c on u.id = c.authorId""">
  let leftJoinWithManyFails () =
    LeftJoinWithManyFails.Command().Execute (new ConnectionContext()) |> print

The expectation was to have comments as an empty list. Is this possible?

@rspeele
Copy link
Collaborator

rspeele commented Sep 26, 2017

Agreed, this should work. Will look into it when I get a chance.

@rspeele rspeele self-assigned this Sep 26, 2017
@rspeele rspeele added the bug label Sep 26, 2017
@Risord
Copy link

Risord commented Nov 17, 2017

Has there been any progress related to this?

@rspeele
Copy link
Collaborator

rspeele commented Nov 19, 2017

I have been getting into some new hobbies lately and haven't worked on this much, but this issue is definitely egregious so I have committed a fix in cbd096d .

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

No branches or pull requests

3 participants