Skip to content

Commit a76ff4f

Browse files
[FIX] XQuery: Repeated evaluation of nondeterministic code. Closes #2395
1 parent c775bd5 commit a76ff4f

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

basex-core/src/main/java/org/basex/query/func/DynFuncCall.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ FItem evalFunc(final QueryContext qc) throws QueryException {
145145
public boolean has(final Flag... flags) {
146146
if(Flag.UPD.oneOf(flags) && (updating || sc().mixUpdates)) return true;
147147
if(Flag.NDT.oneOf(flags) && (ndt || updating || sc().mixUpdates)) return true;
148-
final Flag[] flgs = Flag.remove(flags, Flag.NDT, Flag.UPD);
148+
final Flag[] flgs = Flag.remove(flags, Flag.UPD);
149149
return flgs.length != 0 && super.has(flgs);
150150
}
151151

basex-core/src/test/java/org/basex/query/ast/RewritingsTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3370,4 +3370,10 @@ private static String gh1852(final String query) {
33703370
@Test public void gh2390() {
33713371
query("<p><b/></p>/*[.[self::a union self::b/@x]]", "");
33723372
}
3373+
3374+
/** Repeated evaluation of nondeterministic code. */
3375+
@Test public void gh2395() {
3376+
query("count(distinct-values((1 to 5) ! prof:track((1 to 1000000)[. = 0])?time)) > 1",
3377+
true);
3378+
}
33733379
}

0 commit comments

Comments
 (0)