fix: bug when Null Filtering on embedded resources

When doing Null Filtering, the to-one embed resources were not included if they had a NULL value in any of the selected fields.
This commit is contained in:
Laurence Isla
2023-10-04 00:07:09 -03:00
committed by Steve Chavez
parent 6475f254f7
commit 226f1caa24
4 changed files with 104 additions and 1 deletions
@@ -256,3 +256,22 @@ spec = describe "related queries" $ do
{ matchStatus = 200
, matchHeaders = [matchContentTypeJson]
}
-- "?table=not.is.null" does a "table IS DISTINCT FROM NULL" instead of a "table IS NOT NULL"
-- https://github.com/PostgREST/postgrest/issues/2800#issuecomment-1720315818
it "embeds verifying that the entire target table row is not null" $ do
get "/table_b?select=name,table_a(name)&table_a=not.is.null" `shouldRespondWith`
[json|[
{"name":"Test 1","table_a":{"name":"Not null 1"}},
{"name":"Test 2","table_a":{"name":null}}
]|]
{ matchStatus = 200
, matchHeaders = [matchContentTypeJson]
}
get "/table_b?select=name,table_a()&table_a=is.null" `shouldRespondWith`
[json|[
{"name":"Test 3"}
]|]
{ matchStatus = 200
, matchHeaders = [matchContentTypeJson]
}