You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a function is loaded using load-xquery-module, any declared exist:output-size-limit is not used.
The only way to set exist:output-size-limit is in the function itself.
This differs from function in modules that are loaded using import.
Expected behavior
A function should always use exist:output-size-limit, regardless of how it is loaded.
To Reproduce
Make the following two files in the same eXist collection.
Then execute test-output-size-limit.xql. The output is something like:
exerr:ERROR The constructed document fragment exceeded the predefined output-size-limit (current: 11; allowed: 10). The query has been killed. [at line 9, column 17]
In function:
osl:too-many-nodes() [14:7:/db/apps/_test/test-output-size-limit.xqm]. The constructed document fragment exceeded the predefined output-size-limit (current: 11; allowed: 10). The query has been killed.
<a id="not-many" output-size-limit="5"><b><c/><d/><e><f/></e><g/></b><b><c/><d/><e><f/></e><g/></b><b><c/><d/><e><f/></e><g/></b></a>
<a id="too-many" output-size-limit="5"><b><c/><d/><e><f/></e><g/></b><b><c/><d/><e><f/></e><g/></b><b><c/><d/><e><f/></e><g/></b></a>
exerr:ERROR The constructed document fragment exceeded the predefined output-size-limit (current: 9; allowed: 8). The query has been killed. [at line 21, column 9]
In function:
osl:not-many-nodes(item()*) [7:18:/db/apps/_test/test-output-size-limit.xqm]. The constructed document fragment exceeded the predefined output-size-limit (current: 9; allowed: 8). The query has been killed.
<a id="too-many" output-size-limit="5"><b><c/><d/><e><f/></e><g/></b><b><c/><d/><e><f/></e><g/></b><b><c/><d/><e><f/></e><g/></b></a>
The first result is expected, as there are too many nodes. The second result is expected, because exist:output-size-limit has been set to 100.
The third result is wrong, because all possibly relevant exist:output-size-limit declarations would make the output too large.
The fourth result is expected, because the exist:output-size-limit has been changed inside the function.
The fifth result is maybe wrong. I attempted to use the vendor-options to set exist:output-size-limit, just to see if that would work.
The output-size-limit attributes give the value of util:get-option('exist:output-size-limit'), but they are clearly not the output size limit that is used.
@nverwer thanks for your exhaustive bug report. Have you, by any chance, checked if basex does observe this option regardless of module loading mechanism?
Thank you @joewiz for clarifying why this cannot be tested in BaseX. I never needed load-xquery-module in my BaseX projects, and I was unaware that it is not implemented in BaseX.
Of course, util:declare-option is also unavailable in BaseX, It is possible to do declare option output:limit "100";, which limits the number of serialized bytes, but not in library modules.
I have not been able to find a specification of how options should behave w.r.t. dynamically loaded modules, but I would think that it should not be different from imported modules.
When a function is loaded using
load-xquery-module
, any declaredexist:output-size-limit
is not used.The only way to set
exist:output-size-limit
is in the function itself.This differs from function in modules that are loaded using
import
.Expected behavior
A function should always use
exist:output-size-limit
, regardless of how it is loaded.To Reproduce
Make the following two files in the same eXist collection.
test-output-size-limit.xql
test-output-size-limit.xqm
Then execute
test-output-size-limit.xql
. The output is something like:The first result is expected, as there are too many nodes. The second result is expected, because
exist:output-size-limit
has been set to 100.The third result is wrong, because all possibly relevant
exist:output-size-limit
declarations would make the output too large.The fourth result is expected, because the
exist:output-size-limit
has been changed inside the function.The fifth result is maybe wrong. I attempted to use the
vendor-options
to setexist:output-size-limit
, just to see if that would work.The
output-size-limit
attributes give the value ofutil:get-option('exist:output-size-limit')
, but they are clearly not the output size limit that is used.Context
eXist Version: 6.4.0-SNAPSHOT
eXist Build: 2024-10-29T10:04:56Z
Operating System: Windows 10 10.0 amd64
Java Version: 11.0.14.1
eXist is started via
launcher.bat
.The text was updated successfully, but these errors were encountered: