[Ur] select .. where a <> NULL is not working

Sergey Mironov grrwlf at gmail.com
Tue Jun 17 18:13:37 EDT 2014


OK, i've looked throw the archive and found the answer

http://www.impredicative.com/pipermail/ur/2013-November/001491.html

Sorry for the noise.

Sergey

2014-06-18 2:01 GMT+04:00 Sergey Mironov <grrwlf at gmail.com>:
> Hi. I've just discovered that Ur/Web maps option'ed values to
> NULL/non-NULL representation in the database. Unfortunately, there are
> a big pitfall. Looks like <> NULL clause does not selects all non-NULL
> values. For me it always selects no rows. For example, consider the
> following program:
>
>
> table a : { A : option int }
> task initialize = fn _ =>
>   dml(INSERT INTO a(A) VALUES ({[Some 1]}));
>   r <- oneRow1(SELECT * FROM a WHERE a.A <> {[None]});
>   debug "OK"
>
>
>
> Instead of printing OK it fails with
> Failed to initialize database!
> /home/grwlf/local/lib/urweb/ur/top.ur:366:24-367:3: Query returned no
> rows
>
> Probably, 'a <> b' should be mapped to 'a IS NOT NULL'  or to 'b IS
> NOT NULL' if one of arguments evaluate to NULL, but stay in form 'a <>
> b' otherwise.  In other words, the situation is complex, since
> databases have special NULL algebra..
>
> Please, help!
> Sergey.



More information about the Ur mailing list