chore(deps): update hackage freeze, stackage snapshot and nixpkgs pin
This brings in PostgreSQL 19 beta 1 to start testing against.
This commit is contained in:
@@ -365,7 +365,7 @@ spec withConfig = withConfig baseCfg $
|
||||
context "tables with self reference foreign keys" $ do
|
||||
context "one self reference foreign key" $ do
|
||||
it "embeds parents recursively" $
|
||||
get "/family_tree?id=in.(3,4)&select=id,parent(id,name,parent(*))" `shouldRespondWith`
|
||||
get "/family_tree?id=in.(3,4)&select=id,parent(id,name,parent(*))&order=id" `shouldRespondWith`
|
||||
[json|[
|
||||
{ "id": "3", "parent": { "id": "1", "name": "Parental Unit", "parent": null } },
|
||||
{ "id": "4", "parent": { "id": "2", "name": "Kid One", "parent": { "id": "1", "name": "Parental Unit", "parent": null } } }
|
||||
@@ -390,7 +390,7 @@ spec withConfig = withConfig baseCfg $
|
||||
}]|] { matchHeaders = [matchContentTypeJson] }
|
||||
|
||||
it "embeds parent and then embeds children on a view" $
|
||||
get "/job?select=id,parent_id(*),children:job!parent_id(id,parent_id)" `shouldRespondWith`
|
||||
get "/job?select=id,parent_id(*),children:job!parent_id(id,parent_id)&order=id" `shouldRespondWith`
|
||||
[json|[
|
||||
{
|
||||
"id": 1,
|
||||
@@ -527,13 +527,13 @@ spec withConfig = withConfig baseCfg $
|
||||
context "embedding with col as a target doesn't consider views" $ do
|
||||
-- https://github.com/PostgREST/postgrest/issues/1643
|
||||
it "works with self reference both ways(m2o and o2m)" $ do
|
||||
get "/test?select=id,parent_id,parent:parent_id(id)" `shouldRespondWith`
|
||||
get "/test?select=id,parent_id,parent:parent_id(id)&order=id" `shouldRespondWith`
|
||||
[json| [
|
||||
{ "id": 1, "parent_id": null, "parent": null },
|
||||
{ "id": 2, "parent_id": 1, "parent": { "id": 1 } }
|
||||
] |]
|
||||
{ matchHeaders = [matchContentTypeJson] }
|
||||
get "/test?select=id,parent_id,childs:test(id)" `shouldRespondWith`
|
||||
get "/test?select=id,parent_id,childs:test(id)&order=id" `shouldRespondWith`
|
||||
[json| [
|
||||
{ "id": 1, "parent_id": null, "childs": [ { "id": 2 } ] },
|
||||
{ "id": 2, "parent_id": 1, "childs": [] }
|
||||
|
||||
@@ -5,11 +5,13 @@ import Test.Hspec
|
||||
import Test.Hspec.Wai
|
||||
import Test.Hspec.Wai.JSON
|
||||
|
||||
import PostgREST.Config.PgVersion (PgVersion, pgVersion190)
|
||||
|
||||
import Protolude hiding (get)
|
||||
import SpecHelper
|
||||
|
||||
spec :: SpecWithConfig
|
||||
spec withConfig = withConfig baseCfg $ describe "json and jsonb operators" $ do
|
||||
spec :: PgVersion -> SpecWithConfig
|
||||
spec actualPgVersion withConfig = withConfig baseCfg $ describe "json and jsonb operators" $ do
|
||||
context "Shaping response with select parameter" $ do
|
||||
it "obtains a json subfield one level with casting" $
|
||||
get "/complex_items?id=eq.1&select=settings->>foo::json" `shouldRespondWith`
|
||||
@@ -67,15 +69,27 @@ spec withConfig = withConfig baseCfg $ describe "json and jsonb operators" $ do
|
||||
it "fails when a double arrow ->> is followed with a single arrow ->" $ do
|
||||
get "/json_arr?select=data->>c->1"
|
||||
`shouldRespondWith`
|
||||
[json|
|
||||
{"hint":"No operator matches the given name and argument types. You might need to add explicit type casts.",
|
||||
"details":null,"code":"42883","message":"operator does not exist: text -> integer"} |]
|
||||
(if actualPgVersion < pgVersion190 then
|
||||
[json|
|
||||
{"hint":"No operator matches the given name and argument types. You might need to add explicit type casts.",
|
||||
"details":null,"code":"42883","message":"operator does not exist: text -> integer"} |]
|
||||
else
|
||||
[json|
|
||||
{"hint":"You might need to add explicit type casts.","details":"No operator of that name accepts the given argument types.",
|
||||
"code":"42883","message":"operator does not exist: text -> integer"} |]
|
||||
)
|
||||
{ matchStatus = 404 , matchHeaders = [] }
|
||||
get "/json_arr?select=data->>c->b"
|
||||
`shouldRespondWith`
|
||||
[json|
|
||||
{"hint":"No operator matches the given name and argument types. You might need to add explicit type casts.",
|
||||
"details":null,"code":"42883","message":"operator does not exist: text -> unknown"} |]
|
||||
(if actualPgVersion < pgVersion190 then
|
||||
[json|
|
||||
{"hint":"No operator matches the given name and argument types. You might need to add explicit type casts.",
|
||||
"details":null,"code":"42883","message":"operator does not exist: text -> unknown"} |]
|
||||
else
|
||||
[json|
|
||||
{"hint":"You might need to add explicit type casts.","details":"No operator of that name accepts the given argument types.",
|
||||
"code":"42883","message":"operator does not exist: text -> unknown"} |]
|
||||
)
|
||||
{ matchStatus = 404 , matchHeaders = [] }
|
||||
|
||||
context "with array index" $ do
|
||||
|
||||
@@ -7,11 +7,13 @@ import Test.Hspec hiding (pendingWith)
|
||||
import Test.Hspec.Wai
|
||||
import Test.Hspec.Wai.JSON
|
||||
|
||||
import PostgREST.Config.PgVersion (PgVersion, pgVersion190)
|
||||
|
||||
import Protolude hiding (get)
|
||||
import SpecHelper
|
||||
|
||||
spec :: SpecWithConfig
|
||||
spec withConfig = withConfig baseCfg $ do
|
||||
spec :: PgVersion -> SpecWithConfig
|
||||
spec actualPgVersion withConfig = withConfig baseCfg $ do
|
||||
|
||||
describe "Querying a table with a column called count" $
|
||||
it "should not confuse count column with pg_catalog.count aggregate" $
|
||||
@@ -1651,14 +1653,17 @@ spec withConfig = withConfig baseCfg $ do
|
||||
-- verifies we don't panic or add inappropriate SQL to the filters.
|
||||
it "fails safely on user trying to use ilike operator on data reps column" $
|
||||
get "/datarep_todos?select=id,name&label_color=ilike.#*100" `shouldRespondWith`
|
||||
[json|
|
||||
{"code":"42883","details":null,"hint":"No operator matches the given name and argument types. You might need to add explicit type casts.","message":"operator does not exist: public.color ~~* unknown"}
|
||||
|]
|
||||
(if actualPgVersion < pgVersion190 then
|
||||
[json|
|
||||
{"code":"42883","details":null,"hint":"No operator matches the given name and argument types. You might need to add explicit type casts.","message":"operator does not exist: public.color ~~* unknown"}
|
||||
|]
|
||||
else
|
||||
[json|
|
||||
{"code":"42883","details":"No operator of that name accepts the given argument types.","hint":"You might need to add explicit type casts.","message":"operator does not exist: public.color ~~* unknown"}
|
||||
|]
|
||||
)
|
||||
{ matchStatus = 404
|
||||
, matchHeaders = [
|
||||
"Content-Length" <:> "200",
|
||||
matchContentTypeJson
|
||||
]
|
||||
, matchHeaders = [ matchContentTypeJson ]
|
||||
}
|
||||
|
||||
context "searching for an empty string" $ do
|
||||
|
||||
Reference in New Issue
Block a user