on master help sign in
fix critical bug in relvar assignment due to stale attributes comparison
85c4dc9AgentM
ProjectM36/Error.hs+2−2
@@ -9,7 +9,7 @@ import GHC.Generics (Generic)
9import qualified Data.Text as T
9import qualified Data.Text as T
10
10
11
11
12−data RelationalError = NoSuchAttributeNameError AttributeName
12+data RelationalError = NoSuchAttributeNamesError (S.Set AttributeName)
13 | TupleAttributeCountMismatchError Int --attribute name
13 | TupleAttributeCountMismatchError Int --attribute name
14 | TupleAttributeTypeMismatchError Attributes
14 | TupleAttributeTypeMismatchError Attributes
15 | AttributeCountMismatchError Int
15 | AttributeCountMismatchError Int
@@ -18,7 +18,7 @@ data RelationalError = NoSuchAttributeNameError AttributeName
18 | AttributeIsNotRelationValuedError AttributeName
18 | AttributeIsNotRelationValuedError AttributeName
19 | RelVarNotDefinedError RelVarName
19 | RelVarNotDefinedError RelVarName
20 | RelVarAlreadyDefinedError RelVarName
20 | RelVarAlreadyDefinedError RelVarName
21− | RelVarAssignmentTypeMismatchError
21+ | RelVarAssignmentTypeMismatchError Attributes Attributes --expected, found
22 | InclusionDependencyCheckError IncDepName
22 | InclusionDependencyCheckError IncDepName
23 | ParseError T.Text
23 | ParseError T.Text
24 | PredicateExpressionError T.Text
24 | PredicateExpressionError T.Text
ProjectM36/RelationalExpression.hs+4−2
@@ -223,10 +223,12 @@ evalContextExpr (Assign relVarName expr) = do
223 Left err -> return $ Just err
223 Left err -> return $ Just err
224 Right rel -> case existingRelVar of
224 Right rel -> case existingRelVar of
225 Nothing -> setRelVar relVarName rel
225 Nothing -> setRelVar relVarName rel
226− Just existingRel -> if attributes existingRel == attributes rel then
226+ Just existingRel -> let expectedAttributes = attributes existingRel
227+ foundAttributes = attributes rel in
228+ if A.attributesEqual expectedAttributes foundAttributes then
227 setRelVar relVarName rel
229 setRelVar relVarName rel
228 else
230 else
229− return $ Just RelVarAssignmentTypeMismatchError
231+ return $ Just (RelVarAssignmentTypeMismatchError expectedAttributes foundAttributes)
230
232
231evalContextExpr (Insert relVarName relExpr) = evalContextExpr $ Assign relVarName (Union relExpr (RelationVariable relVarName))
233evalContextExpr (Insert relVarName relExpr) = evalContextExpr $ Assign relVarName (Union relExpr (RelationVariable relVarName))
232
234