Re: Using || operator to fold multiple columns into one
От | Craig Ringer |
---|---|
Тема | Re: Using || operator to fold multiple columns into one |
Дата | |
Msg-id | 4B32DB14.6080308@postnewspapers.com.au обсуждение исходный текст |
Ответ на | Re: Using || operator to fold multiple columns into one (Rosser Schwarz <rosser.schwarz@gmail.com>) |
Ответы |
Re: Using || operator to fold multiple columns into one
|
Список | pgsql-sql |
On 24/12/2009 5:04 AM, Rosser Schwarz wrote: > On Wed, Dec 23, 2009 at 1:44 AM, Craig Ringer > <craig@postnewspapers.com.au> wrote: > >> SELECT COALESCE( t_number::text, t:string::text, t_date::text, t_boolean::text) AS value; > > Your invocation of COALESCE is incorrect -- it is n-ary, but it > returns its first non-NULL argument. Yes. That was the point. I think we're assuming the OP wants different things. You're assuming they're trying to concatenate all fields, where more than one field in a given record may be non-null. I'm assuming that all but one field in each record will be null, and they want to show the "value" of the record - in other words, they're using the record as a sort of union type. It looks like that from the example they gave. -- Craig Ringer
В списке pgsql-sql по дате отправления: