disallow limit/offset on views

This commit is contained in:
steve-chavez
2022-03-26 15:29:13 +01:00
committed by Steve Chavez
parent 73dc2692b1
commit f3f9030c48
8 changed files with 52 additions and 7 deletions
+2 -1
View File
@@ -29,6 +29,7 @@ spec =
[json| {
"tableName": "orders_view", "tableSchema": "test",
"tableDeletable": true, "tableUpdatable": true,
"tableInsertable": true, "tableDescription": null
"tableIsView":true, "tableInsertable": true,
"tableDescription": null
} |]
{ matchHeaders = [matchContentTypeJson] }
+10 -1
View File
@@ -3,7 +3,7 @@ module Feature.Query.DeleteSpec where
import Network.Wai (Application)
import Network.HTTP.Types
import Test.Hspec
import Test.Hspec hiding (pendingWith)
import Test.Hspec.Wai
import Test.Hspec.Wai.JSON
@@ -213,7 +213,16 @@ spec =
`shouldRespondWith` ""
{ matchStatus = 204 }
it "doesn't work with views" $
request methodDelete "/limited_delete_items_view?limit=1&offset=1"
[("Prefer", "tx=commit")]
mempty
`shouldRespondWith`
[json| {"hint":null,"details":null,"code":"PGRST507","message":"limit/offset is not implemented for views"} |]
{ matchStatus = 501 }
it "works with views with an inferred pk" $ do
pendingWith "not implemented yet"
get "/limited_delete_items_view"
`shouldRespondWith`
[json|[
+9
View File
@@ -520,7 +520,16 @@ spec = do
`shouldRespondWith` ""
{ matchStatus = 204 }
it "doesn't work with views" $
request methodPatch "/limited_update_items_view?limit=1&offset=1"
[("Prefer", "tx=commit")]
[json| {"name": "updated-item"} |]
`shouldRespondWith`
[json| {"hint":null,"details":null,"code":"PGRST507","message":"limit/offset is not implemented for views"} |]
{ matchStatus = 501 }
it "works with views with an inferred pk" $ do
pendingWith "not implemented yet"
get "/limited_update_items_view"
`shouldRespondWith`
[json|[