Re: [GENERAL] Needed function IF(expr, expr, expr)

Поиск
Список
Период
Сортировка
От Rod Taylor
Тема Re: [GENERAL] Needed function IF(expr, expr, expr)
Дата
Msg-id 1062977129.54737.46.camel@jester
обсуждение исходный текст
Ответ на Re: [GENERAL] Needed function IF(expr, expr, expr)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [GENERAL] Needed function IF(expr, expr, expr)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> Any comments on the UNKNOWN issue?  It's not too late to change that for
> 7.4, if we have consensus that we should.

I would actually prefer to get UNKNOWN so I can apply my own default
type, but we're not even given the chance to resolve the unknown issue
ourselves.

CREATE OR REPLACE FUNCTION if(bool,anyelement,anyelement)
RETURNS anyelement
AS 'SELECT
     CASE WHEN $2 is of (unknown) THEN
            CASE WHEN $1 THEN $2::point ELSE $3::point END
          ELSE
            CASE WHEN $1 THEN $2 ELSE $3 END
          END' language SQL;
CREATE FUNCTION
rbt=# select if(true, '33', '44');
ERROR:  could not determine ANYARRAY/ANYELEMENT type because input is
UNKNOWN


Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Jenny -"
Дата:
Сообщение: Re: table-level and row-level locks.
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: table-level and row-level locks.