public inbox for [email protected]  
help / color / mirror / Atom feed
From: Stephen Froehlich <[email protected]>
To: Chamath Sajeewa <[email protected]>
Cc: [email protected] <[email protected]>
Subject: RE: Pgsql error in coalesce
Date: Mon, 27 Jul 2020 17:18:22 +0000
Message-ID: <CH2PR06MB6470C24B3FCBDDFA763E55B3E5720@CH2PR06MB6470.namprd06.prod.outlook.com> (raw)
In-Reply-To: <CACpofehvF5i2SdGOktfR7-HiJOtmfpq2aX+_yJ=efC7xZ3L0YQ@mail.gmail.com>
References: <CACpofejQ12OBATx9Mi1YB24bj4Y4Ey6gq0fmncPp-b3hAyRtyQ@mail.gmail.com>
	<CH2PR06MB64706ABCFCB27BAACBC50BD8E5720@CH2PR06MB6470.namprd06.prod.outlook.com>
	<CACpofehvF5i2SdGOktfR7-HiJOtmfpq2aX+_yJ=efC7xZ3L0YQ@mail.gmail.com>

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 <[email protected]>
Sent: Monday, July 27, 2020 11:15
To: Stephen Froehlich <[email protected]>
Cc: [email protected]
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, <[email protected]<mailto:[email protected]>> 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 <[email protected]<mailto:[email protected]>>
Sent: Monday, July 27, 2020 10:51
To: [email protected]<mailto:[email protected]>
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!!


view thread (10+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: RE: Pgsql error in coalesce
  In-Reply-To: <CH2PR06MB6470C24B3FCBDDFA763E55B3E5720@CH2PR06MB6470.namprd06.prod.outlook.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox