fix: character and bit columns with fixed length not inserting/updating properly

Fixes the error "value too long for type character(1)" when the char length of the column was bigger than one.
This commit is contained in:
Laurence Isla
2023-07-21 11:30:01 -05:00
committed by GitHub
parent 28d5278d62
commit 630e0a1691
6 changed files with 57 additions and 13 deletions
+16
View File
@@ -384,6 +384,22 @@ spec actualPgVersion = do
, matchHeaders = ["Preference-Applied" <:> "missing=default"]
}
-- https://github.com/PostgREST/postgrest/issues/2861
context "bit and char columns with length" $ do
it "should update a bit column with length" $
request methodPatch "/bitchar_with_length?char=eq.aaaaa"
[("Prefer", "return=representation")]
[json|{"bit": "11100"}|]
`shouldRespondWith` [json|[{ "bit": "11100", "char": "aaaaa" }]|]
{ matchStatus = 200 }
it "should update a char column with length" $
request methodPatch "/bitchar_with_length?bit=eq.00000"
[("Prefer", "return=representation")]
[json|{"char": "zzzyy"}|]
`shouldRespondWith` [json|[{ "bit": "00000", "char": "zzzyy" }]|]
{ matchStatus = 200 }
context "tables with self reference foreign keys" $ do
context "embeds children after update" $ do
it "without filters" $