generate aggregate order by types only if relevant columns are present, closes #1243 (#1248)

This commit is contained in:
Rakesh Emmadi 2018-12-20 19:31:54 +05:30 committed by Vamshi Surabhi
parent 9b229651eb
commit 63acd0e7b2

View File

@ -1143,12 +1143,16 @@ input table_<op>_order_by {
mkTabAggOpOrdByInpObjs
:: QualifiedTable -> [PGCol] -> [PGCol] -> [InpObjTyInfo]
mkTabAggOpOrdByInpObjs tn numCols compCols =
map (mkInpObjTy numCols) numAggOps <> map (mkInpObjTy compCols) compAggOps
mapMaybe (mkInpObjTyM numCols) numAggOps
<> mapMaybe (mkInpObjTyM compCols) compAggOps
where
mkDesc (G.Name op) = G.Description $ "order by " <> op <> "() on columns of table " <>> tn
mkInpObjTyM cols op = bool (Just $ mkInpObjTy cols op) Nothing $ null cols
mkInpObjTy cols op = mkHsraInpTyInfo (Just $ mkDesc op) (mkTabAggOpOrdByTy tn op) $
fromInpValL $ map mkColInpVal cols
mkColInpVal c = InpValInfo Nothing (mkColName c) $ G.toGT
ordByTy