Re: concatenation with a null column (using ||) nulls the result?
От
Terry Lee Tucker
Тема
Re: concatenation with a null column (using ||) nulls the result?
Дата
Msg-id
200604101803.53355.terry@esc1.com
Ответ на
Re: concatenation with a null column (using ||) nulls the result? (Alvaro Herrera)
Список
Дерево обсуждения
concatenation with a null column (using ||) nulls the result? Neil Harkins <nharkins@well.com>
Re: concatenation with a null column (using ||) nulls the Ross Johnson <ross.johnson@homemail.com.au>
Re: concatenation with a null column (using ||) nulls the result? Alvaro Herrera <alvherre@commandprompt.com>
Re: concatenation with a null column (using ||) nulls the result? Terry Lee Tucker <terry@esc1.com>
Re: concatenation with a null column (using ||) nulls the result? Tom Lane <tgl@sss.pgh.pa.us>
On Monday 10 April 2006 05:55 pm, Alvaro Herrera saith: > Neil Harkins wrote: > > Note: The cabinets_description for the "548-4th-Cab1" row is " ", > > not NULL, hence it being displayed. Is this standard SQL behavior? > > Yes; something || NULL yields NULL. If you want NULL to behave as "" > for the purpose of the concatenation, try > > SELECT cabinets_name || ' - ' || COALESCE(cabinets_description, '') AS > concat FROM cabinets WHERE cabinets_datacenters = 2; > > I'm assuming cabinets_name is NOT NULL, so it doesn't need COALESCE. > > -- Good to know. Thanks for the input...
В списке pgsql-sql по дате отправления
От: Alvaro Herrera
Дата: