map:merge() does not handle wrong $option parameter
Sunday, 21 April 2019 · 2 messages
AM
Andreas Mixich21 Apr 2019 04:54 #
Given:
let $d1 := map {"key1":"value1"}
let $d2 := map {"key2":"value2"}
return map:merge($d1, $d2)where the two maps to be merged should have been included as sequence, but were, mistakenly, not, the function should return an error, since the second map gets evaluated as $options, but none of the $options are to be found inside.
It seems, that only a type-check is done, to assure valid $options, since, in another case, I got a [XPTY0004].
--
Minden jót, all the best, Alles Gute,
Andreas Mixich
CG
Christian Grün21 Apr 2019 09:01 #
Hi Andreas,
This is in compliance with the rules of the specification [1]. In the BaseX-specific functions, we raise errors; maybe this is the other case you mentioned?
Christian
[1] https://www.w3.org/TR/xpath-functions-31/#option-parameter-conventions
Andreas Mixich <mixich.andreas at gmail.com> schrieb am So., 21. Apr. 2019, 04:55:
Quoted text · Andreas Mixich · 18 lines
> Given: > > let $d1 := map {"key1":"value1"} > let $d2 := map {"key2":"value2"} > return map:merge($d1, $d2) > > where the two maps to be merged should have been included as sequence, but > were, mistakenly, not, the function should return an error, since the > second map gets evaluated as $options, but none of the $options are to be > found inside. > > It seems, that only a type-check is done, to assure valid $options, since, > in another case, I got a [XPTY0004]. > > -- > Minden jót, all the best, Alles Gute, > Andreas Mixich >
Written for BaseX 9.2. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery