string concatenation

Поиск
Список
Период
Сортировка
От Gyorgy Molnar
Тема string concatenation
Дата
Msg-id 000d01c273b6$aee48850$6e01a8c0@dell8100
обсуждение исходный текст
Ответ на Re: firstest doubts...  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: string concatenation
Re: string concatenation
Список pgsql-general
plase take a look to the following small sample

CREATE FUNCTION test(TEXT) RETURNS TEXT AS '
DECLARE
    cmd TEXT;
BEGIN
    RETURN cmd || ''Hello'';
END;
' LANGUAGE 'plpgsql';

When I execute the function

select test('');
 test
------

(1 row)

I got an empty string for result. I think I got this result because the
string concatenation ("||") was created with "isstrict" flag. In this case
it will give back NULL object if one of the arguments was NULL object.

In most of the cases I think it is ok, but specially for the string
concatenation is not really convinient.

Is this feature will change in the future? Any "smart" solution for this
problem? - I cannot use the IF..ENDIF statement before each string
concatenation, I have too many in my code.

Best Regards,
Yuri


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

Предыдущее
От: Francois Suter
Дата:
Сообщение: Advocacy site in French
Следующее
От: frbn
Дата:
Сообщение: Re: pg admin problem