string concatenation - Mailing list pgsql-general

From Gyorgy Molnar
Subject string concatenation
Date
Msg-id 000d01c273b6$aee48850$6e01a8c0@dell8100
Whole thread Raw
In response to Re: firstest doubts...  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: string concatenation
Re: string concatenation
List 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 by date:

Previous
From: Francois Suter
Date:
Subject: Advocacy site in French
Next
From: frbn
Date:
Subject: Re: pg admin problem