fix: Allow schema names with special characters in the search path

Fixes regression where the search path did not recognize schemas with uppercase, spaces and other special characters in their names.
This commit is contained in:
Laurence Isla
2022-06-23 18:54:43 -05:00
committed by GitHub
parent 870f7a39b0
commit f7745e1569
11 changed files with 60 additions and 13 deletions
+14 -3
View File
@@ -68,11 +68,22 @@ spec =
it "fails trying to read table from unkown schema" $
request methodGet "/parents" [("Accept-Profile", "unkown")] "" `shouldRespondWith`
[json|{"message":"The schema must be one of the following: v1, v2","code":"PGRST106","details":null,"hint":null}|]
[json|{"message":"The schema must be one of the following: v1, v2, SPECIAL \"@/\\#~_-","code":"PGRST106","details":null,"hint":null}|]
{
matchStatus = 406
}
it "succeeds in reading a table from a schema with uppercase and special characters in its name" $
request methodGet "/names" [("Accept-Profile", "SPECIAL \"@/\\#~_-")] "" `shouldRespondWith`
[json|[
{"id":1,"name":"John"},
{"id":2,"name":"Mary"}
]|]
{
matchStatus = 200
, matchHeaders = [matchContentTypeJson, "Content-Profile" <:> "SPECIAL \"@/\\#~_-"]
}
context "Inserting tables on different schemas" $ do
it "succeeds inserting on default schema and returning it" $
request methodPost "/children"
@@ -111,7 +122,7 @@ spec =
request methodPost "/children" [("Content-Profile", "unknown")]
[json|{"name": "child 4", "parent_id": 4}|]
`shouldRespondWith`
[json|{"message":"The schema must be one of the following: v1, v2","code":"PGRST106","details":null,"hint":null}|]
[json|{"message":"The schema must be one of the following: v1, v2, SPECIAL \"@/\\#~_-","code":"PGRST106","details":null,"hint":null}|]
{
matchStatus = 406
}
@@ -325,7 +336,7 @@ spec =
it "fails trying to read definitions from unkown schema" $
request methodGet "/" [("Accept-Profile", "unkown")] "" `shouldRespondWith`
[json|{"message":"The schema must be one of the following: v1, v2","code":"PGRST106","details":null,"hint":null}|]
[json|{"message":"The schema must be one of the following: v1, v2, SPECIAL \"@/\\#~_-","code":"PGRST106","details":null,"hint":null}|]
{
matchStatus = 406
}