string concatenation

From: "Gyorgy Molnar" <yuri(at)powercom(dot)com(dot)sg>
To: <pgsql-general(at)postgresql(dot)org>
Subject: string concatenation
Date: 2002-10-14 19:16:03
Message-ID: 000d01c273b6$aee48850$6e01a8c0@dell8100
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Wood 2002-10-14 19:29:35 Re: drop constraint unnamed?
Previous Message Justin Clift 2002-10-14 19:07:46 Re: Anyone want to assist with the translation of the Advocacy