Re: C vs. C++ contributions - Mailing list pgsql-hackers

From Mario Weilguni
Subject Re: C vs. C++ contributions
Date
Msg-id 200208290857.06894.mweilguni@sime.com
Whole thread Raw
In response to Re: C vs. C++ contributions  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: C vs. C++ contributions
List pgsql-hackers
> > feature of that type.  But random misfeatures such as the join syntax or
> > the decode() function are going to have a hard time getting accepted.
>
> But we have decode():
>
>     test=> \df decode
>                           List of functions
>      Result data type |   Schema   |  Name  | Argument data types
>     ------------------+------------+--------+---------------------
>      bytea            | pg_catalog | decode | text, text
>     (1 row)
>
> Is this a different decode?

Yes this is completly different. Oracle decode works like this:

decode(value, choice1, result1, choice 2, result2, ......, default_result)

it works this way:
case  when value=choice1 then result1 when value=choice2 then result2 .... else default_result
end

The nice part is it has an varying number of arguments, and can used within "sort". Very useful sometimes.

Another one very useful oracle function is "nvl", the same like "coalesce", but a lot easier to write :-)




pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: tweaking MemSet() performance
Next
From: Tatsuo Ishii
Date:
Subject: #ifdef MULTIBYTE removed