Left join entity is never null

Aperta
#697 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
fsharp, sql
Ambito
databases

Direzione di ricerca

Non sono indicati file sorgente né test. Inizia riproducendo entrambe le forme di query dell’issue con SQLProvider v1.1.93, concentrandoti su leftOuterJoin, DefaultIfEmpty() e sull’entità con valore predefinito segnalata. Il lavoro è completato quando la sintassi supportata e il comportamento previsto in caso di entità mancante sono documentati o testati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug
I am trying to left join "sheets" entity but I can't get it to work properly.

The documentation says that leftOuterJoin is not supported, but I see examples on stackoverflow of people saying this works.
For me it does not.

query {
        for e in ctx.Dbo.TimeEntries do
        join t in ctx.Dbo.ProjectTasks on (e.TaskId = t.Id)
        leftOuterJoin sheet in ctx.Dbo.DrawingLogSheets on (e.SheetId = Some sheet.Id) into sheetResults
        for s in sheetResults.DefaultIfEmpty() do
        where (e.Email = Some email && e.Date = dateOnly)
        select (toTimeEntry(e, t, s))
    }

This fails with an error.

I also tried this approach:

query {
        for e in ctx.Dbo.TimeEntries do
        join t in ctx.Dbo.ProjectTasks on (e.TaskId = t.Id)
        join s in (!!) ctx.Dbo.DrawingLogSheets on (e.SheetId = Some s.Id)
        where (e.Email = Some email && e.Date = dateOnly)
        select (toTimeEntry(e, t, s))
    }

This kind of works, but sheet is never null when it is missing; instead, it has all its values defaulted. For example, its ID field is a new guid (all zeros), and its string values are all empty string. I suppose I could check for defaulted guid, but this just feels like something is not right.

To Reproduce

Expected behavior
In the first example (leftOuterJoin), I just want to verify whether this syntax is supposed to be supported or not.
In the second example (!!), I would expect the sheet entity to be null when no sheet is joined, but instead it is instantiated with all default values.

Screenshots

Desktop (please complete the following information):

  • Windows
  • SQLProvider is v1.1.93

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Lingua principale
F#
Stelle
627
Fork
147
Merge medio
2h 2m
PR unite (30g)
1

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di fsprojects/SQLProvider

Tutte le issue di fsprojects/SQLProvider

Issue simili

Altre issue su Databases

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.