Re: [GENERAL] Problem using NULLIF in a CASE expression

2005-09-09 Thread Richard Huxton
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

Re: [GENERAL] Problem using NULLIF in a CASE expression

2005-09-09 Thread Roger Hand
Try this: SELECT CASE WHEN btrim(' A string', ' ') = '' OR IS NULL THEN NULL ELSE 6 END AS type_id; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Bruno BAGUETTE Sent: Friday, September 09, 2005 4:45 AM To: pgsql-general@

Re: [GENERAL] Problem using NULLIF in a CASE expression

2005-09-09 Thread Csaba Nagy
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