fix: clarify PGRST204 error message

This commit is contained in:
steve-chavez
2024-04-01 19:03:14 -05:00
committed by Steve Chavez
parent 6de3ba543d
commit 2543b8d724
4 changed files with 8 additions and 7 deletions
+1
View File
@@ -27,6 +27,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- #3327, Fix slow responses on schema cache reloads - @steve-chavez - #3327, Fix slow responses on schema cache reloads - @steve-chavez
- #3340, Log when the LISTEN channel gets a notification - @steve-chavez - #3340, Log when the LISTEN channel gets a notification - @steve-chavez
- #3345, Fix in-database configuration values not loading for `pgrst.server_trace_header` and `pgrst.server_cors_allowed_origins` - @laurenceisla - #3345, Fix in-database configuration values not loading for `pgrst.server_trace_header` and `pgrst.server_cors_allowed_origins` - @laurenceisla
- #3361, Clarify PGRST204(column not found) error message - @steve-chavez
### Deprecated ### Deprecated
+1 -1
View File
@@ -249,7 +249,7 @@ instance JSON.ToJSON ApiRequestError where
(Just "Try renaming the parameters or the function itself in the database so function overloading can be resolved") (Just "Try renaming the parameters or the function itself in the database so function overloading can be resolved")
toJSON (ColumnNotFound relName colName) = toJsonPgrstError toJSON (ColumnNotFound relName colName) = toJsonPgrstError
SchemaCacheErrorCode04 ("Column '" <> colName <> "' of relation '" <> relName <> "' does not exist") Nothing Nothing SchemaCacheErrorCode04 ("Could not find the '" <> colName <> "' column of '" <> relName <> "' in the schema cache") Nothing Nothing
-- | -- |
-- If no relationship is found then: -- If no relationship is found then:
+3 -3
View File
@@ -469,7 +469,7 @@ spec actualPgVersion = do
{"id": 204, "body": "yyy"}, {"id": 204, "body": "yyy"},
{"id": 205, "body": "zzz"}]|] {"id": 205, "body": "zzz"}]|]
`shouldRespondWith` `shouldRespondWith`
[json|{"code":"PGRST204","details":null,"hint":null,"message":"Column 'helicopter' of relation 'articles' does not exist"} |] [json|{"code":"PGRST204","details":null,"hint":null,"message":"Could not find the 'helicopter' column of 'articles' in the schema cache"} |]
{ matchStatus = 400 { matchStatus = 400
, matchHeaders = [] , matchHeaders = []
} }
@@ -851,7 +851,7 @@ spec actualPgVersion = do
request methodPost "/datarep_todos?columns=id,label_color,helicopters&select=id,name,label_color,due_at" [("Prefer", "return=representation")] request methodPost "/datarep_todos?columns=id,label_color,helicopters&select=id,name,label_color,due_at" [("Prefer", "return=representation")]
[json| {"due_at": "2019-01-03T11:00:00+00", "smth": "here", "label_color": "invalid", "fake_id": 13} |] [json| {"due_at": "2019-01-03T11:00:00+00", "smth": "here", "label_color": "invalid", "fake_id": 13} |]
`shouldRespondWith` `shouldRespondWith`
[json| {"code":"PGRST204","message":"Column 'helicopters' of relation 'datarep_todos' does not exist","details":null,"hint":null} |] [json| {"code":"PGRST204","details":null,"hint":null,"message":"Could not find the 'helicopters' column of 'datarep_todos' in the schema cache"} |]
{ matchStatus = 400 { matchStatus = 400
, matchHeaders = ["Content-Type" <:> "application/json; charset=utf-8"] , matchHeaders = ["Content-Type" <:> "application/json; charset=utf-8"]
} }
@@ -906,7 +906,7 @@ spec actualPgVersion = do
request methodPost "/datarep_todos_computed?columns=id,label_color,helicopters&select=id,name,label_color,due_at" [("Prefer", "return=representation")] request methodPost "/datarep_todos_computed?columns=id,label_color,helicopters&select=id,name,label_color,due_at" [("Prefer", "return=representation")]
[json| {"due_at": "2019-01-03T11:00:00+00", "smth": "here", "label_color": "invalid", "fake_id": 13} |] [json| {"due_at": "2019-01-03T11:00:00+00", "smth": "here", "label_color": "invalid", "fake_id": 13} |]
`shouldRespondWith` `shouldRespondWith`
[json| {"code":"PGRST204","message":"Column 'helicopters' of relation 'datarep_todos_computed' does not exist","details":null,"hint":null} |] [json| {"code":"PGRST204","details":null,"hint":null,"message":"Could not find the 'helicopters' column of 'datarep_todos_computed' in the schema cache"} |]
{ matchStatus = 400 { matchStatus = 400
, matchHeaders = ["Content-Type" <:> "application/json; charset=utf-8"] , matchHeaders = ["Content-Type" <:> "application/json; charset=utf-8"]
} }
+3 -3
View File
@@ -342,7 +342,7 @@ spec actualPgVersion = do
[("Prefer", "return=representation")] [("Prefer", "return=representation")]
[json|{"body": "yyy"}|] [json|{"body": "yyy"}|]
`shouldRespondWith` `shouldRespondWith`
[json|{"code":"PGRST204","details":null,"hint":null,"message":"Column 'helicopter' of relation 'articles' does not exist"} |] [json|{"code":"PGRST204","details":null,"hint":null,"message":"Could not find the 'helicopter' column of 'articles' in the schema cache"}|]
{ matchStatus = 400 { matchStatus = 400
, matchHeaders = [] , matchHeaders = []
} }
@@ -888,7 +888,7 @@ spec actualPgVersion = do
request methodPatch "/datarep_todos?id=eq.2&columns=label_color,helicopters" [("Prefer", "return=representation")] request methodPatch "/datarep_todos?id=eq.2&columns=label_color,helicopters" [("Prefer", "return=representation")]
[json| {"due_at": "2019-01-03T11:00:00Z", "smth": "here", "label_color": "invalid", "fake_id": 13} |] [json| {"due_at": "2019-01-03T11:00:00Z", "smth": "here", "label_color": "invalid", "fake_id": 13} |]
`shouldRespondWith` `shouldRespondWith`
[json| {"code":"PGRST204","message":"Column 'helicopters' of relation 'datarep_todos' does not exist","details":null,"hint":null} |] [json| {"code":"PGRST204","details":null,"hint":null,"message":"Could not find the 'helicopters' column of 'datarep_todos' in the schema cache"} |]
{ matchStatus = 400 { matchStatus = 400
, matchHeaders = ["Content-Type" <:> "application/json; charset=utf-8"] , matchHeaders = ["Content-Type" <:> "application/json; charset=utf-8"]
} }
@@ -978,7 +978,7 @@ spec actualPgVersion = do
request methodPatch "/datarep_todos_computed?id=eq.2&columns=label_color,helicopters" [("Prefer", "return=representation")] request methodPatch "/datarep_todos_computed?id=eq.2&columns=label_color,helicopters" [("Prefer", "return=representation")]
[json| {"due_at": "2019-01-03T11:00:00Z", "smth": "here", "label_color": "invalid", "fake_id": 13} |] [json| {"due_at": "2019-01-03T11:00:00Z", "smth": "here", "label_color": "invalid", "fake_id": 13} |]
`shouldRespondWith` `shouldRespondWith`
[json| {"code":"PGRST204","message":"Column 'helicopters' of relation 'datarep_todos_computed' does not exist","details":null,"hint":null} |] [json| {"code":"PGRST204","details":null,"hint":null,"message":"Could not find the 'helicopters' column of 'datarep_todos_computed' in the schema cache"} |]
{ matchStatus = 400 { matchStatus = 400
, matchHeaders = ["Content-Type" <:> "application/json; charset=utf-8"] , matchHeaders = ["Content-Type" <:> "application/json; charset=utf-8"]
} }