Bruno BAGUETTE wrote:
I wrote another (and quite shorter!) SQL query to resume the problem :
SELECT CASE NULLIF(btrim(' A string', ' '), '')
WHEN NOT NULL
THEN NULL
ELSE 6
END AS type_id;
ERROR: operator does not exist: text = boolean
Why this query does not a
2005 4:45 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Problem using NULLIF in a CASE expression
Hello,
I have a problem using NULLIF inside a CASE expression.
I explain the goal of my query : I have a table where there is two
fields : one varchar field and one INT8 field.
When the va
You're misusing the case construct, and try to compare a text result
(from the 'nullif') with a boolean result (from the 'not null'). You
probably should use the other form of case:
SELECT CASE WHEN NULLIF(btrim(' A string', ' '), ') IS NULL THEN NULL
ELSE 6 END AS type_id;
I guess you were looki
Hello,
I have a problem using NULLIF inside a CASE expression.
I explain the goal of my query : I have a table where there is two
fields : one varchar field and one INT8 field.
When the varchar field is empty I have to display the INT8 field.
If the varchar field is not empty I have to display