1.1 Warnings
1.1.1 Comparisons with NULL
CQLv2 correctly compiles equality comparisons with NULL into the appropriate expression at runtime. In CQLv1, executing
A={null}, {[A], foo :: [a-A]}
would never succeed, regardless of the value of foo.a. This is no
longer the case: If A is {null}
then this will execute as SELECT .... WHERE a IS NULL
and if A is not {null}, it will execute as SELECT .... WHERE a = ?
See the section Removing null comparisions for the dealing with the common requirement to ignore comparisons with null.
1.1.2 Avoid setof/3 and bagof/3
It is generally not a good idea to wrap CQL inside a setof/3 or a bagof/3 ... unless you are prepared to declare all the CQL variables that are neither bound nor mentioned in the setof/bagof template. If you want to sort, use findall/3 followed by sort/2. Note that sort/2 (like setof/3) removes duplicates. If you don't want to remove duplicates, use msort/2.