Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-22995

JQL query "fixVersion >= B AND fixVersion <= D" returns unexpected results

      Steps to reproduce:
      1. Create a project with versions A, B, C, D, and E (or 1, 2, 3, 4, 5, etc), A being the first version and E being the last.
      2. Create a six issues, the first with fix version as A, the second as B, and so on, then one with the fix version as A and E.
      3. In the Issue Navigator, run the following JQL query: fixVersion >= "B" AND fixVersion <= "D"

      Expected results:
      The issues with fix version B, C, and D are returned.

      Actual results:
      The issues with fix versions B, C, and D are indeed returned, but so is the issue with fix versions A and E.

      The same issue occurs if you use just < and > instead of >= and <=.

            [JRASERVER-22995] JQL query "fixVersion >= B AND fixVersion <= D" returns unexpected results

            We don't have an alternative for this at the moment, sorry.

            Eric Dalgliesh added a comment - We don't have an alternative for this at the moment, sorry.

            Dmitry added a comment -

            Is there an alternative syntax maybe? The one that would allow to specify a range condition for a single value instead of a set of conditions for a combination of values?

            Something like fixVersion IN (B - D) or fixVersion BETWEEN B AND D.

            Regexp check in the versionMatch of the script runner mentioned above is not flexible enough in my case.

            Dmitry added a comment - Is there an alternative syntax maybe? The one that would allow to specify a range condition for a single value instead of a set of conditions for a combination of values? Something like fixVersion IN (B - D) or fixVersion BETWEEN B AND D . Regexp check in the versionMatch of the script runner mentioned above is not flexible enough in my case.

            This still doesn't address the case of, this is a bug (or isn't).

            The current stance is this is not a bug.

            Mark, could you link the documentation? I couldn't find the one you're referencing and I'd like to either adjust it to clarify it and prevent further confusion, or discover I've got this all wrong.

            Here is the truth table using 3 in place of 2:

            fix version on issue is there a fix version greater than 1 (fixVersion > 1) is there a fix version less than 2 (fixVersion < 2) is there a fixVersion that is greater than one and a fixVersion that is less than two (fixVersion > 1 AND fixVersion < 2)
            1 false true false
            3 true false false
            1,3 true true true

            In the case of ">1.0 and <3.0" - this should not match an issue with a fixVersion of 3.0, unless it also has another fixVersion that is less than 3.0, in which case it should match. Here's a diagram that I hope clears things up:

            I assume that mfernandes@atlassian.com, (and nmason, and me until I began investigating it), was confused by this issue as it's non-intuitive, but I have not spoken to him.

            Eric Dalgliesh added a comment - This still doesn't address the case of, this is a bug (or isn't). The current stance is this is not a bug. Mark, could you link the documentation? I couldn't find the one you're referencing and I'd like to either adjust it to clarify it and prevent further confusion, or discover I've got this all wrong. Here is the truth table using 3 in place of 2: fix version on issue is there a fix version greater than 1 (fixVersion > 1) is there a fix version less than 2 (fixVersion < 2) is there a fixVersion that is greater than one and a fixVersion that is less than two (fixVersion > 1 AND fixVersion < 2) 1 false true false 3 true false false 1,3 true true true In the case of ">1.0 and <3.0" - this should not match an issue with a fixVersion of 3.0, unless it also has another fixVersion that is less than 3.0, in which case it should match. Here's a diagram that I hope clears things up: I assume that mfernandes@atlassian.com , (and nmason , and me until I began investigating it), was confused by this issue as it's non-intuitive, but I have not spoken to him.

            Eric, Have you spoken with Matheus Fernandes regarding JSP-155216? I provided the use-case and a copy of our database to be analyzed. Engineering looked at it, and determined it was a bug. I was told to watch this issue for resolution, only to have the issue closed as not a bug months later.

            Your truth table doesn't address the issue being discussed here. Nobody's debating versions 1 and 2 appearing. We're debating version "3" appearing, which per your truth table, it should not.

            This is further complicated by the fact that we're not talking about values here. We're talking about positioning of versions relative to each other within the project. My releases could look like:

            1.0
            6.0
            2.0
            10.0
            3.0

            >1.0 and <3.0 should include issues with 6.0, 2.0 or 10.0, but NOT 1.0 or 3.0. This is per the documentation.

            AIRe, we have script runner, and will look into versionMatch. I wasn't aware of it, but a regex version match is what the user wanted all along. They only went with "anchoring versions" to search between as a workaround.

            This still doesn't address the case of, this is a bug (or isn't).

            Mark Montminy added a comment - Eric, Have you spoken with Matheus Fernandes regarding JSP-155216? I provided the use-case and a copy of our database to be analyzed. Engineering looked at it, and determined it was a bug. I was told to watch this issue for resolution, only to have the issue closed as not a bug months later. Your truth table doesn't address the issue being discussed here. Nobody's debating versions 1 and 2 appearing. We're debating version "3" appearing, which per your truth table, it should not. This is further complicated by the fact that we're not talking about values here. We're talking about positioning of versions relative to each other within the project. My releases could look like: 1.0 6.0 2.0 10.0 3.0 >1.0 and <3.0 should include issues with 6.0, 2.0 or 10.0, but NOT 1.0 or 3.0. This is per the documentation. AIRe, we have script runner, and will look into versionMatch. I wasn't aware of it, but a regex version match is what the user wanted all along. They only went with "anchoring versions" to search between as a workaround. This still doesn't address the case of, this is a bug (or isn't).

            AlexanderR added a comment -

            Hey Mark,

            the problem is that one instinctively thinks something different of the way the query works or at least should work. Anyway, as this won't bring you any further I suggest you look into the script runner plugin and the provided jql abilities:

            https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+JQL+Functions#ScriptedJQLFunctions-projectMatch(regexp)/componentMatch/versionMatch

            At least for us this solved the issue.

            Hope that I could help.

            AlexanderR added a comment - Hey Mark, the problem is that one instinctively thinks something different of the way the query works or at least should work. Anyway, as this won't bring you any further I suggest you look into the script runner plugin and the provided jql abilities: https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+JQL+Functions#ScriptedJQLFunctions-projectMatch(regexp)/componentMatch/versionMatch At least for us this solved the issue. Hope that I could help.

            Unless I've seriously misunderstood something, this is not a bug. I'll reduce this down to the smallest case that exhibits the behaviour: only two versions (1 and 2) in that order.

            The query "fixVersion > 1 and fixVersion < 2" does not translate to "there is a fix version that is both less than 2 and is greater than one". Instead it translates to "there is a fixVersion that is less than 2 and there is a (possibly different) fixVersion that is greater than 1"

            Here's a truth table detailing the expected outcome:

            fix version on issue is there a fix version greater than 1 (fixVersion > 1) is there a fix version less than 2 (fixVersion < 2) is there a fixVersion that is greater than one and a fixVersion that is less than two (fixVersion > 1 AND fixVersion < 2)
            1 false true false
            2 true false false
            1,2 true true true

            Eric Dalgliesh added a comment - Unless I've seriously misunderstood something, this is not a bug. I'll reduce this down to the smallest case that exhibits the behaviour: only two versions (1 and 2) in that order. The query "fixVersion > 1 and fixVersion < 2" does not translate to "there is a fix version that is both less than 2 and is greater than one". Instead it translates to "there is a fixVersion that is less than 2 and there is a (possibly different) fixVersion that is greater than 1" Here's a truth table detailing the expected outcome: fix version on issue is there a fix version greater than 1 (fixVersion > 1) is there a fix version less than 2 (fixVersion < 2) is there a fixVersion that is greater than one and a fixVersion that is less than two (fixVersion > 1 AND fixVersion < 2) 1 false true false 2 true false false 1,2 true true true

            I don't understand how this can be considered intended. We experience the same behavior, and it's starting to cause significant issues as the suggested workaround of using "fixversion in (a, b, c)" is now exceeding the length limit of a JQL query for our users.

            fixVersion >= 2 AND fixVersion <= 4 should not match 1, because of the AND clause.

            When I submitted this issue to support, I received the following response:

            me and our Senior Support Engineers have been testing this locally with your data. It turns out this is actually a bug in JIRA, which is currently being tracked here:
            JRA-22995: JQL query "fixVersion >= B AND fixVersion <= D" returns unexpected results

            So is it a bug or isn't it? If it's not a bug, someone needs to explain why this doesn't work as documented, and how we can achieve the desired results.

            Mark Montminy added a comment - I don't understand how this can be considered intended. We experience the same behavior, and it's starting to cause significant issues as the suggested workaround of using "fixversion in (a, b, c)" is now exceeding the length limit of a JQL query for our users. fixVersion >= 2 AND fixVersion <= 4 should not match 1, because of the AND clause. When I submitted this issue to support, I received the following response: me and our Senior Support Engineers have been testing this locally with your data. It turns out this is actually a bug in JIRA, which is currently being tracked here:  JRA-22995 : JQL query "fixVersion >= B AND fixVersion <= D" returns unexpected results So is it a bug or isn't it? If it's not a bug, someone needs to explain why this doesn't work as documented, and how we can achieve the desired results.

            andreas.mauch@de.trumpf.com, in the case you mention, 1 matches the clause "fixVersion <= 4", and 5 matches the clause "fixVersion >= 2". It might not match expectations, but this is how JQL is intended to work.

            Eric Dalgliesh added a comment - andreas.mauch@de.trumpf.com , in the case you mention, 1 matches the clause "fixVersion <= 4", and 5 matches the clause "fixVersion >= 2". It might not match expectations, but this is how JQL is intended to work.

            Hello,

            when I create a JQL query like this: fixVersion >= "B" AND fixVersion <= "D"
            then I hope to get the fixVersions "B", "C" and "D" only and not "A", "B", "C", "D" and "E".
            Also if I use the fixVersion ID like fixVersion >= 2 AND fixVersion <= 4 because the fixVersions "A" (1) and "E" (5) are
            not in the JQL where clause.

            So I think this is a bug and not worked as designed.

            Best regards

            Andreas Mauch

            Andreas Mauch added a comment - Hello, when I create a JQL query like this: fixVersion >= "B" AND fixVersion <= "D" then I hope to get the fixVersions "B", "C" and "D" only and not "A", "B", "C", "D" and "E". Also if I use the fixVersion ID like fixVersion >= 2 AND fixVersion <= 4 because the fixVersions "A" (1) and "E" (5) are not in the JQL where clause. So I think this is a bug and not worked as designed. Best regards Andreas Mauch

            This is working as designed. JQL is inclusive so saying (version >= 1 AND version <= 6) will look for all issues which contain a version matching >= 1 and a version <=6; these versions do not have to be the same versions. To exclude versions you need to use the NOT predicate.

            Eric Dalgliesh added a comment - This is working as designed. JQL is inclusive so saying (version >= 1 AND version <= 6) will look for all issues which contain a version matching >= 1 and a version <=6; these versions do not have to be the same versions. To exclude versions you need to use the NOT predicate.

              Unassigned Unassigned
              nmason Nick Mason
              Affected customers:
              5 This affects my team
              Watchers:
              14 Start watching this issue

                Created:
                Updated:
                Resolved: