XQuery boolean datatype handling

View: New views
2 Messages — Rating Filter:   Alert me  

XQuery boolean datatype handling

by Matt Magoffin-4 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

If I run this XQuery:

for $match in collection('matchback.dbxml')/als:match-back-matches
where $match/@has-match = true()
return $match

I get a single result (which is not expected), while if I change true() to
'true' like this:

for $match in collection('matchback.dbxml')/als:match-back-matches
where $match/@has-match = 'true'
return $match

I get many, many results (which is expected). In general I've seen this
type of boolean handling discrepancy in many of my queries. I would have
thought if the true() function was an inappropriate use in this query,
that no results would be returned, not "some" results.

I also notice the optimized query plans are slightly different for these
queries:

With true():
n(V(node-attribute-equality-boolean,@has-match,=,'true'),P(node-element-presence-none,=,match-back-matches:http://autoleadservice.com/xml/als))

With 'true':
n(P(node-element-presence-none,=,match-back-matches:http://autoleadservice.com/xml/als),P(node-attribute-equality-boolean,prefix,@has-match))

I have a boolean index defined on the @has-match attribute, as well a a
default string-equality index for all attributes. Is it OK to have
overlapping indices defined in this way?

-- m@



------------------------------------------
To remove yourself from this list, send an
email to xml-unsubscribe@...


Re: XQuery boolean datatype handling

by Matt Magoffin-4 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Sorry I hadn't noticed the post about moving to the Oracle forums... I
will re-post this message there.

-- m@

> If I run this XQuery:
>
> for $match in collection('matchback.dbxml')/als:match-back-matches
> where $match/@has-match = true()
> return $match
>
> I get a single result (which is not expected), while if I change true() to
> 'true' like this:
>
> for $match in collection('matchback.dbxml')/als:match-back-matches
> where $match/@has-match = 'true'
> return $match
>
> I get many, many results (which is expected). In general I've seen this
> type of boolean handling discrepancy in many of my queries. I would have
> thought if the true() function was an inappropriate use in this query,
> that no results would be returned, not "some" results.
>
> I also notice the optimized query plans are slightly different for these
> queries:
>
> With true():
> n(V(node-attribute-equality-boolean,@has-match,=,'true'),P(node-element-presence-none,=,match-back-matches:http://autoleadservice.com/xml/als))
>
> With 'true':
> n(P(node-element-presence-none,=,match-back-matches:http://autoleadservice.com/xml/als),P(node-attribute-equality-boolean,prefix,@has-match))
>
> I have a boolean index defined on the @has-match attribute, as well a a
> default string-equality index for all attributes. Is it OK to have
> overlapping indices defined in this way?
>
> -- m@
>
>
>
> ------------------------------------------
> To remove yourself from this list, send an
> email to xml-unsubscribe@...
>
>



------------------------------------------
To remove yourself from this list, send an
email to xml-unsubscribe@...