Re: Concat error in PL/pgsql

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Hans Peter Wuermli <wurmli@freesurf.ch>
Cc: pgsql-bugs@postgresql.org
Date: 2001-01-06T21:38:21Z
Lists: pgsql-bugs
Hans Peter Wuermli <wurmli@freesurf.ch> writes:
> Within a plpgsql function, concatenating TEXT strings from tables that
> allow NULL values return nil results.

That's not a bug: NULL concatenated with anything produces NULL,
per SQL92 specification.

If you want a NULL to act like an empty string, try

	for r in select * from tconcattest loop
		  output := output || coalesce(r.str, '''');

			regards, tom lane