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

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]>
Sent: Monday, July 27, 2020 10:51
To: [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: <CH2PR06MB64706ABCFCB27BAACBC50BD8E5720@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