(text/x-fossil-wiki)
Consider the statements below:
<pre>
SELECT LIKELY(CAST(1 AS INT)) = '1'; -- expected: 0, actual: 1
SELECT UNLIKELY(CAST(1 AS INT)) = '1'; -- expected: 0, actual: 1
SELECT LIKELIHOOD(CAST(1 AS INT), 0.5) = '1'; -- expected: 0, actual: 1
</pre>
All statements return 1, which is somehow unexpected, since functions are expected to have no affinity; however, it seems that for these functions, the affinity of the function argument is assumed (for LIKELIHOOD, the affinity of the first argument is taken).
This bug report is similar to [d60b3cd7cb], where it was reported that the COLLATE operator takes the affinity of the expression applied to, and resulted in a documentation update.
|