From: | Harald Fuchs <use_reply_to(at)protecting(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: no IF - am I missing something ? |
Date: | 2005-03-21 14:26:45 |
Message-ID: | pufyyp3wii.fsf@srv.protecting.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
In article <20050321075049(dot)GA18302(at)winnie(dot)fuhr(dot)org>,
Michael Fuhr <mike(at)fuhr(dot)org> writes:
> On Mon, Mar 21, 2005 at 12:35:22AM -0600, Thomas F.O'Connell wrote:
>> The number of lines depends merely on where you place your line breaks.
>>
>> IF(days_complete <= 120, job_price, 0)AS Days_120
>>
>> could be written as:
>>
>> CASE WHEN days_complete <= 120 THEN job_price ELSE 0 END AS Days_120
>>
>> There might be somewhat less syntactic sugar, but this is not a five
>> line expression and, to me, is more readable than a comma-delimited
>> list where position alone indicates function in the expression.
> CASE is also standard SQL, whereas IF isn't (unless I've overlooked
> it in the SQL:2003 draft).
CASE, despite being standard SQL, is even supported by MySQL ;-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-03-21 15:16:14 | Re: pg_dump large-file support > 16GB |
Previous Message | FERREIRA William (COFRAMI) | 2005-03-21 14:22:31 | pl/perl problem |