WHERE clause and boolean semantics

15 views
Skip to first unread message

Roland Bouman

unread,
Aug 10, 2011, 11:31:38 AM8/10/11
to UnQL
Hi!

In Syntax Notes 14, it reads:

"
Documents may be removed from a collection using the DELETE
statement:DELETE FROM collection-name WHERE expression
Only those documents for which expression is true are removed from the
collection.
* A "null" value is not true.
* A numeric value other than 0 or 0.0 is true.
* A string value is not true unless it can be interpreted as a non-
zero numeric value.
* Arrays and objects are not true.
"

On thing that I wonder about is if the boolean semantics expressed
here apply only to the expression after the WHERE keyword, or also
*inside* expression syntax.

See, the expression syntax reminds my about javascript, and I assume
it was designed exactly with that in mind. But then the last two items
in the list propose a boolean semantics that are very different from
ordinary javascript boolean semantics.

My concern is twofold:
1) if these boolean semantics are in effect only for the entire
expression appearing after the WHERE clause, it will be confusing
because that semantics will be different from the semantics of sub-
expressions
2) if these boolean semantics are in effect for all expressions at all
levels, the syntax will look and feel like javascript, but act very
different.

Either way, it seems confusing.

Perhaps I misinterpreted the text, in which case I'd love to have this
pointed out to me. Otherwise, I'd love to hear opinions on my remarks
- perhaps I am misjudging how confusing this seems.

p...@pi.net

unread,
Aug 12, 2011, 7:22:11 AM8/12/11
to UnQL
> Perhaps I misinterpreted the text, in which case I'd love to have this
> pointed out to me. Otherwise, I'd love to hear opinions on my remarks
> - perhaps I am misjudging how confusing this seems.

I think you are right: the semantics should be uniform. As long as the
javascript semantics are meaningful and practical in a database
context, the javascript semantics should apply. I agree that Note 14
does not seem to make sense if javascript compatibility is the goal.

Roland Bouman

unread,
Aug 15, 2011, 8:03:37 PM8/15/11
to UnQL
Thanks! Language authors, what's your idea on this?

Hans Marggraff

unread,
Aug 29, 2011, 10:05:46 AM8/29/11
to UnQL
* A "null" value is not true.
* Arrays and objects are not true.

If that is true, then it makes boolean semantics of values quite
worthless. Should be changed or clarified.
Reply all
Reply to author
Forward
0 new messages