Re: Concat error in PL/pgsql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hans Peter Wuermli <wurmli(at)freesurf(dot)ch>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Concat error in PL/pgsql
Date: 2001-01-06 21:38:21
Message-ID: 18636.978817101@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hans Peter Wuermli <wurmli(at)freesurf(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert B. Easter 2001-01-06 22:31:25 boolean bugs
Previous Message Hans Peter Wuermli 2001-01-06 17:29:22 Concat error in PL/pgsql