on 2012 Aug 17 8:41 PM
Hi again,
I have found that, when you mix UNION and subqueries, Ultralite doesn't return the results I have expected.
Let me post the simplest example I could think of:
SELECT (SELECT 1) UNION SELECT (SELECT 1)
Instead of returning 1, it returns 0. Similarly:
SELECT (SELECT 'a') UNION SELECT (SELECT 'a')
Instead of returning 'a', it returns an empty string.
I think this also extrapolates to more complex cases, such as when I put a subquery in a CASE, like this one:
SELECT 1 as id, CASE id WHEN 1 THEN (SELECT 'a') ELSE (SELECT 'b') END as name UNION SELECT 2 as id, CASE id WHEN 1 THEN (SELECT 'a') ELSE (SELECT 'b') END as name
It returns:
1 | (empty string) 2 | (empty string)
While if you put the literals without the subquery it works fine:
SELECT 1 as id, CASE id WHEN 1 THEN ('a') ELSE ('b') END as name UNION SELECT 2 as id, CASE id WHEN 1 THEN ('a') ELSE ('b') END as name
It returns:
1 | 'a' 2 | 'b'
Thank you André for reporting this bug.
This (incorrect evaluation of subqueries with UNION) has been fixed as of 12.0.1.3787 in CR #718317.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.