refactor: clarify Scalar type

It now contains the type of the scalar. This way we can discriminate the
void type in a more obvious way.
This commit is contained in:
steve-chavez
2023-04-13 18:17:43 -05:00
committed by Steve Chavez
parent feadf59bb3
commit ce378e6b3a
3 changed files with 9 additions and 12 deletions
+3 -6
View File
@@ -247,7 +247,6 @@ decodeFuncs =
<*> column HD.text
<*> column HD.bool
<*> column HD.bool
<*> column HD.bool
<*> column HD.bool)
<*> (parseVolatility <$> column HD.char)
<*> column HD.bool
@@ -255,16 +254,15 @@ decodeFuncs =
addKey :: Routine -> (QualifiedIdentifier, Routine)
addKey pd = (QualifiedIdentifier (pdSchema pd) (pdName pd), pd)
parseRetType :: Text -> Text -> Bool -> Bool -> Bool -> Bool -> RetType
parseRetType schema name isSetOf isComposite isVoid isCompositeAlias
| isVoid = Single $ Scalar True
parseRetType :: Text -> Text -> Bool -> Bool -> Bool -> RetType
parseRetType schema name isSetOf isComposite isCompositeAlias
| isSetOf = SetOf pgType
| otherwise = Single pgType
where
qi = QualifiedIdentifier schema name
pgType
| isComposite = Composite qi isCompositeAlias
| otherwise = Scalar False
| otherwise = Scalar qi
parseVolatility :: Char -> FuncVolatility
parseVolatility v | v == 'i' = Immutable
@@ -339,7 +337,6 @@ funcsSqlQuery pgVer = [q|
-- if any TABLE, INOUT or OUT arguments present, treat as composite
or COALESCE(proargmodes::text[] && '{t,b,o}', false)
) AS rettype_is_composite,
('void'::regtype = t.oid) AS rettype_is_void,
bt.oid <> bt.base as rettype_is_composite_alias,
p.provolatile,
p.provariadic > 0 as hasvariadic