fix: paramaters of type character and bit not ignoring length

- Fixes the error "value too long for type character(1)" when the char length of the parameter was bigger than one.
This commit is contained in:
Laurence Isla
2023-07-31 18:36:37 -05:00
committed by GitHub
parent 0dc67bed0b
commit 40c2bcd4a1
8 changed files with 72 additions and 16 deletions
+8
View File
@@ -259,6 +259,7 @@ decodeFuncs =
(RoutineParam
<$> compositeField HD.text
<*> compositeField HD.text
<*> compositeField HD.text
<*> compositeField HD.bool
<*> compositeField HD.bool)
<*> (parseRetType
@@ -367,6 +368,13 @@ funcsSqlQuery pgVer = [q|
array_agg((
COALESCE(name, ''), -- name
type::regtype::text, -- type
CASE type
WHEN 'bit'::regtype THEN 'bit varying'
WHEN 'bit[]'::regtype THEN 'bit varying[]'
WHEN 'character'::regtype THEN 'character varying'
WHEN 'character[]'::regtype THEN 'character varying[]'
ELSE type::regtype::text
END, -- convert types that ignore the lenth and accept any value till maximum size
idx <= (pronargs - pronargdefaults), -- is_required
COALESCE(mode = 'v', FALSE) -- is_variadic
) ORDER BY idx) AS args,