fix: filter on unselected columns in a table-valued function

This commit is contained in:
Taimoor Zaeem
2025-04-27 14:20:13 -05:00
committed by Steve Chavez
parent cd5a611a1a
commit f53147674e
5 changed files with 57 additions and 4 deletions
+28
View File
@@ -1422,3 +1422,31 @@ spec =
, matchHeaders = [ "Content-Length" <:> "105"
, matchContentTypeJson ]
}
context "test table valued function with filter" $ do
it "works with filter on unselected columns" $
request methodGet "/rpc/getallprojects?select=id,client_id&name=like.OSX"
[] ""
`shouldRespondWith`
[json| [{"id":4,"client_id":2}] |]
{ matchStatus = 200
, matchHeaders = [matchContentTypeJson]
}
it "works with filter on unselected columns with null embed" $
request methodGet "/rpc/getallprojects?select=id,clients(id)&clients.name=not.is.null"
[] ""
`shouldRespondWith`
[json| [{"id":1,"clients":{"id": 1}}, {"id":2,"clients":{"id": 1}}, {"id":3,"clients":{"id": 2}}, {"id":4,"clients":{"id": 2}}, {"id":5,"clients":null}] |]
{ matchStatus = 200
, matchHeaders = [matchContentTypeJson]
}
it "works with logical filter on unselected columns" $
request methodGet "/rpc/getallprojects?select=id,client_id&or=(name.like.OSX,name.like.IOS)"
[] ""
`shouldRespondWith`
[json| [{"id":3,"client_id":2}, {"id":4,"client_id":2}] |]
{ matchStatus = 200
, matchHeaders = [matchContentTypeJson]
}