RE: [EXTERNAL] Pgsql error in coalesce

Поиск
Список
Период
Сортировка
От Vianello, Dan A
Тема RE: [EXTERNAL] Pgsql error in coalesce
Дата
Msg-id f76fe0eb980941a3ad33400dd833bfcc@NCEMEXGP001.CORP.CHARTERCOM.com
обсуждение исходный текст
Ответ на Pgsql error in coalesce  (Chamath Sajeewa <csgsajeewa@gmail.com>)
Список pgsql-novice

Your column name “column_name” is of type text. The number 255 is an integer.  Since those datatypes don’t match the coalesce function fails.  If the data in “column_name” can always be cast to an integer then you can use

 

Select coalesce(column_name::integer, 255);

 

Or you can cast 255 to a text string of ‘255’ with this:

Select coalesce(column_name, '255'::text);

 

 

The contents of this e-mail message and
any attachments are intended solely for the
addressee(s) and may contain confidential
and/or legally privileged information. If you
are not the intended recipient of this message
or if this message has been addressed to you
in error, please immediately alert the sender
by reply e-mail and then delete this message
and any attachments. If you are not the
intended recipient, you are notified that
any use, dissemination, distribution, copying,
or storage of this message or any attachment
is strictly prohibited.

В списке pgsql-novice по дате отправления:

Предыдущее
От: Stephen Froehlich
Дата:
Сообщение: RE: Pgsql error in coalesce
Следующее
От: Chamath Sajeewa
Дата:
Сообщение: Re: [EXTERNAL] Pgsql error in coalesce