From: | Stephen Froehlich <s(dot)froehlich(at)cablelabs(dot)com> |
---|---|
To: | Chamath Sajeewa <csgsajeewa(at)gmail(dot)com> |
Cc: | "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org> |
Subject: | RE: Pgsql error in coalesce |
Date: | 2020-07-27 17:18:22 |
Message-ID: | CH2PR06MB6470C24B3FCBDDFA763E55B3E5720@CH2PR06MB6470.namprd06.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
The documentation says nothing about it … so no I have no clue. Personally, I tend to use that function in R more than I do in PostgreSQL.
From: Chamath Sajeewa <csgsajeewa(at)gmail(dot)com>
Sent: Monday, July 27, 2020 11:15
To: Stephen Froehlich <s(dot)froehlich(at)cablelabs(dot)com>
Cc: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Re: Pgsql error in coalesce
Hi,
Query is working properly when column_name::integer is used. I wonder Why is it required when column type is already set to int4. Any idea?
On Mon, 27 Jul 2020, 22:35 Stephen Froehlich, <s(dot)froehlich(at)cablelabs(dot)com<mailto:s(dot)froehlich(at)cablelabs(dot)com>> wrote:
What do you get with the following two type castings:
SELECT coalesce(column_name::integer, 255); ?
SELECT coalesce(column_name, ‘255’::text)::integer; ?
“integer” might actually be “smallint” if you’re only going to 255.
--Stephen
From: Chamath Sajeewa <csgsajeewa(at)gmail(dot)com<mailto:csgsajeewa(at)gmail(dot)com>>
Sent: Monday, July 27, 2020 10:51
To: pgsql-novice(at)lists(dot)postgresql(dot)org<mailto:pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Pgsql error in coalesce
Hi,
There is table with int4 column. When select query is executed as "select coalesce(column_name, 255), query is failing with below error.
"COALESCE types text and integer cannot be mached".
Any idea?
Thank You!!
From | Date | Subject | |
---|---|---|---|
Next Message | Vianello, Dan A | 2020-07-27 17:27:00 | RE: [EXTERNAL] Pgsql error in coalesce |
Previous Message | Chamath Sajeewa | 2020-07-27 17:15:02 | Re: Pgsql error in coalesce |