我试图理解为什么此Redshift查询的WHERE
子句正在评估FALSE
而不返回任何结果。
CREATE TEMPORARY TABLE temp AS (SELECT 1 AS id);
问题:此查询不返回任何结果 -
SELECT *
FROM (
SELECT
id,
FALSE as test
FROM temp)
WHERE test = FALSE;
此查询返回预期的一行 -
SELECT *
FROM (
SELECT
id,
(SELECT FALSE) as test
FROM temp)
WHERE test = FALSE;
另外,这可以正常工作 -
CREATE TEMPORARY TABLE temp2 AS (SELECT 1 AS id, FALSE AS test);
SELECT *
FROM (
SELECT
id,
test
FROM temp)
WHERE test = FALSE;