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