fix: null filtering on embed when column=relation
This commit is contained in:
committed by
Steve Chavez
parent
2977d09779
commit
2d00d7d248
@@ -233,18 +233,6 @@ spec = describe "related queries" $ do
|
||||
, matchHeaders = [matchContentTypeJson]
|
||||
}
|
||||
|
||||
it "only works with is null or is not null operators" $
|
||||
get "/projects?select=name,clients(*)&clients=eq.3" `shouldRespondWith`
|
||||
[json|{
|
||||
"code":"PGRST120",
|
||||
"details":"Only is null or not is null filters are allowed on embedded resources",
|
||||
"hint":null,
|
||||
"message":"Bad operator on the 'clients' embedded resource"
|
||||
}|]
|
||||
{ matchStatus = 400
|
||||
, matchHeaders = [matchContentTypeJson]
|
||||
}
|
||||
|
||||
it "doesn't interfere filtering when embedding using the column name" $
|
||||
get "/projects?select=name,client_id,client:client_id(name)&client_id=eq.2" `shouldRespondWith`
|
||||
[json|[
|
||||
@@ -254,3 +242,17 @@ spec = describe "related queries" $ do
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = [matchContentTypeJson]
|
||||
}
|
||||
|
||||
it "doesn't interfere filtering on column names used for disambiguation" $
|
||||
get "/user_friend?select=*,user1(*)&user1=eq.a02fb934-3a4d-469b-a6b6-4fcd88b973cf" `shouldRespondWith`
|
||||
[json|[]|]
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = [matchContentTypeJson]
|
||||
}
|
||||
|
||||
it "doesn't interfere filtering on column names that are the same as the relation name" $
|
||||
get "/tournaments?select=*,status(*)&status=eq.3" `shouldRespondWith`
|
||||
[json|[]|]
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = [matchContentTypeJson]
|
||||
}
|
||||
|
||||
Vendored
+21
@@ -3308,3 +3308,24 @@ CREATE TABLE bitchar_with_length (
|
||||
bit bit(5),
|
||||
char char(5)
|
||||
);
|
||||
|
||||
--- https://github.com/PostgREST/postgrest/issues/2862
|
||||
create table profiles (
|
||||
id uuid primary key,
|
||||
username text null
|
||||
);
|
||||
|
||||
create table user_friend (
|
||||
id bigint primary key,
|
||||
user1 uuid references profiles (id),
|
||||
user2 uuid references profiles (id)
|
||||
);
|
||||
|
||||
create table status(
|
||||
id bigint primary key
|
||||
);
|
||||
|
||||
create table tournaments(
|
||||
id bigint primary key,
|
||||
status bigint references status(id)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user