From: | "Vianello, Dan A" <Dan(dot)Vianello(at)charter(dot)com> |
---|---|
To: | Chamath Sajeewa <csgsajeewa(at)gmail(dot)com>, "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org> |
Subject: | RE: [EXTERNAL] Pgsql error in coalesce |
Date: | 2020-07-27 17:27:00 |
Message-ID: | f76fe0eb980941a3ad33400dd833bfcc@NCEMEXGP001.CORP.CHARTERCOM.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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);
E-MAIL CONFIDENTIALITY NOTICE:
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Chamath Sajeewa | 2020-07-27 17:32:42 | Re: [EXTERNAL] Pgsql error in coalesce |
Previous Message | Stephen Froehlich | 2020-07-27 17:18:22 | RE: Pgsql error in coalesce |