5 Replies Latest reply on Jul 30, 2020 3:43 AM by Duncan Grisby

    Behavior of parenthesis in queries

    Rémi Chaffard
      Share This:



      I saw something strange in a CAM generated pattern regarding query. One of our modeler made a mistake in the Any / All group conditions in the CAM, resulting in the following query in the pattern:


      search Database where type = "SQL Server Database" or (instance = "X" or instance = "Y")


      For me this query should return all "SQL Server Database" items plus all databases where instance is X or Y, and be equivalent to:


      search Database where type = "SQL Server Database" or instance = "X" or instance = "Y"


      But surprisingly they are not equivalent, and the first query return only the Database having instance X or Y, without all the others.


      May I know if it is a normal behavior or what could be the cause of it. Trying some stuff in a python console to be sure and I don't understand:


      >>> True or (False or False)
      >>> True or False or False
      >>> False or (False or True)
      >>> False and (False or True)