I have migrated a database from 4.1.4 to 4.2.1 and some XQuerys have disparate results
an example of these XQuerys is :
for $a in input()/general/anyo
where $a/@id=“1995”
return
{$a/@id}
{$a/[count()=0]}
with 4.1.4, I have the next response:
<min_margen>110960.75</min_margen>
<min_ventas>554803.75</min_ventas>
<ventas_coste>443843</ventas_coste>
<ventas_neto>590957</ventas_neto>
<ventas_bruto>631905</ventas_bruto>
<num_clientes>84</num_clientes>
<max_t_entrega>21.6605</max_t_entrega>
<media_t_entrega>19.6605</media_t_entrega>
<min_num_clientes>82</min_num_clientes>
And with 4.2.1 this one:
Have I forgotten anything, or is some kind of bug?
What type does the id attribute have in the schema? One of the changes between 4.1 and 4.2 is stricter type checking. I know I had to change queries from things like ?@date=“2004-10-11”? to ?@date=xs:date(“2004-10-11”)? when I upgraded.
The type is String.
I believe that the problems is in the result part “{$a/[count()=0]}”. If I change the XQuery to something like this:
for $a in input()/general/anyo
where $a/@id=“1995”
return
{$a/@id}
{$a/[not()]}
it works again.
But I think that modifing the query is not the solution…
Hi,
The different results of the queries:
for $a in input()/general/anyo
where $a/@id=“1995”
return
{$a/@id}
{$a/[count()=0]}
and
for $a in input()/general/anyo
where $a/@id=“1995”
return
{$a/@id}
{$a/[not()]}
is caused by a bug in the Tamino 4.2 XQuery processor. We will fix that problem.
Best regards,
Thorsten
Hi,
The type of your id attribute depends on your schema. But the name of the attribute suggests that it has the type xs:ID.
An attribute of type xs:ID can be compared with a string literal. This is due to the fact that xs:string is a subtype of xs:ID.
Best regards,
Thorsten