fix: unexpected results when embedding the same table twice

This commit is contained in:
Laurence Isla
2026-04-29 09:10:48 +00:00
committed by Wolfgang Walther
parent ea08a4d767
commit 5f6f7dca44
5 changed files with 43 additions and 2 deletions
+11 -1
View File
@@ -1070,6 +1070,16 @@ spec = do
{ "id":4,"children":[]}
]|] { matchHeaders = [matchContentTypeJson] }
it "works when embedding the same table more than once" $
get "/places?select=name,visits(id,start_time,visit_type),work_visits:visits(id,start_time,visit_type)&id=eq.1&visits.visit_type=neq.work&visits.start_time=gt.20250101+00:00&work_visits.visit_type=eq.work&work_visits.start_time=gt.20250101+00:00" `shouldRespondWith`
[json|[
{
"name":"Lake",
"visits":[{"id": 1, "start_time": "2025-01-01T10:00:00", "visit_type": "vacation"}, {"id": 2, "start_time": "2025-01-01T15:00:00", "visit_type": "vacation"}],
"work_visits":[{"id": 3, "start_time": "2025-01-01T20:00:00", "visit_type": "work"}]
}
]|] { matchHeaders = [matchContentTypeJson] }
describe "ordering response" $ do
it "by a column asc" $
get "/items?id=lte.2&order=id.asc"
@@ -1152,7 +1162,7 @@ spec = do
{ matchHeaders = [matchContentTypeJson] }
it "ordering embeded entities with alias" $
get "/projects?id=eq.1&select=id, name, the_tasks:tasks(id, name)&tasks.order=name.asc" `shouldRespondWith`
get "/projects?id=eq.1&select=id, name, the_tasks:tasks(id, name)&the_tasks.order=name.asc" `shouldRespondWith`
[json|[{"id":1,"name":"Windows 7","the_tasks":[{"id":2,"name":"Code w7"},{"id":1,"name":"Design w7"}]}]|]
{ matchHeaders = [matchContentTypeJson] }