Kayden
11/29/2024, 1:57 AMMain Table:
- id
- tenantId
- ...
- middleTableId
Middle Table:
- id
- tenantId
- ...
- endTableId
End Table:
- id
- tenantId
- ...
- name
The query looks something like this:
• mainTable.id (showAllValues: false)
• mainTable.field2 (showAllValues: true)
• mainTable.field3 (showAllValues: true)
• endTable.name (showAllValues: true)
We have a WDF on tenantId for every table. (Any associated records will have the same tenantId, since they originate from the same tenant.)
Without the WDF, endTable.name is properly nullable. Once the WDF is active, entire rows, where middleTable.endTableId
is empty, are not returned.
I'm guessing this is because the WDF doesn't pass on endTable (since endTable.tenantId == null, for a null record). However, shouldn't this instead return a null value for endTable.name
(and still return the rest of the row)?Kayden
11/29/2024, 2:07 AM{ // mainTable
id: 4
tenantId: "abcd",
middleTableId: 25
{ // LEFT JOIN middleTable ON mainTable.middleTableId = middleTable.id
id: 25,
tenantId: "abcd",
endTableId: 12
{ // LEFT JOIN endTable ON middleTable.endTableId = endTable
id: 12,
tenantId: "abcd", // WDF passes.
name: "Kayden" // this value is returned properly.
}
}
}
This entire record is only returned when the WDF is inactive:
{ // mainTable
id: 99
tenantId: "abcd",
middleTableId: 88
{ // LEFT JOIN middleTable ON mainTable.middleTableId = middleTable.id
id: 88,
tenantId: "abcd",
endTableId: null
{ // LEFT JOIN endTable ON middleTable.endTableId = endTable
id: null,
tenantId: null, // WDF fails! This stops the mainTable record from ever being returned.
name: null // when the WDF is inactive, this value is returned properly.
}
}
}
Kayden
11/29/2024, 2:09 AMmainTable
records, and one which shows details (including its endTable.name
, if one exists). Customers are concerned about the inaccurate reporting, since they see "57 records" but then can only view the details from 54 of them.Ivana Gasparekova
11/29/2024, 2:15 AMIvana Gasparekova
11/29/2024, 2:24 AMKayden
11/29/2024, 2:33 AMtenantId
field on each table, which is non-null – the WDF is on that field.
In my example query above, I'm fetching four values:
• mainTable.id (showAllValues: false)
• mainTable.field2 (showAllValues: true)
• mainTable.field3 (showAllValues: true)
• endTable.name (showAllValues: true)
The only field that is required is mainTable.id. In fact, there may not even be an endTable record at all! Hence why endTable.name is an outer join (showAllValues: true).
The two example objects are as follows:
1. mainTable has an endTable record -> WDF passes for endTable.name -> returns entire record properly
2. mainTable does not have an endTable record -> WDF does not pass for endTable.name -> does not return entire record
So in my results table, mainTable.id 4
would show up, but mainTable.id 99
would not. If I removed endTable.name
from the query entirely, both records would show up.Kayden
11/29/2024, 2:34 AMendTable.name
is actually nullable, since the WDF seems to override that.Kayden
11/29/2024, 2:43 AM{ // mainTable
id: 99
tenantId: "abcd",
middleTableId: 88
{ // LEFT JOIN middleTable ON mainTable.middleTableId = middleTable.id
id: 88,
tenantId: "abcd",
endTableId: null
// LEFT JOIN endTable ON middleTable.endTableId = endTable
// > the above JOIN statement returns null, thus endTable.tenantId = null
// > since null <> "abcd", WDF fails! This stops the mainTable record from ever being returned.
// > When the WDF is inactive, rather than not returning the mainTable record at all,
// > it returns null for endTable.name, still returning the rest of the mainTable data.
}
}
}
Julius Kos
12/03/2024, 10:28 AMKayden
12/03/2024, 6:10 PM