From: biju.george@ust-global.com
To: pgsql-bugs@postgresql.org
Subject: BUG #6609: pattern matching (version 8.2 or so...)
Date: Mon, 23 Apr 2012 15:16:40 +0000
Message-ID: <E1SML0K-0007Bo-TH@wrigleys.postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 6609
Logged by: biju george
Email address: biju.george@ust-global.com
PostgreSQL version: Unsupported/Unknown
Operating system: Linux
Description:
I have a text column which have values like
'01abcd','012345','abcde',etc...
Now I am trying to take the first 2 characters of the column and pass into a
function which takes only integer values and returns an integer. So, I need
to check before I input into the function whether the substring is integer
or not. If integer then the return value else default value say 99.
select my_function(case when substr(my_column,1,2) like '[0-9][0-9]' then
substr(my_column,1,2) else 99 end) from my_table;
I tried like, =, ~. Nothing seems to work. Tried ::text, ::integer and
all...
It always throws error --
ERROR: CASE types integer and text cannot be matched
The darn thing just don't work... :mad:
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: biju.george@ust-global.com
Subject: Re: BUG #6609: pattern matching (version 8.2 or so...)
In-Reply-To: <E1SML0K-0007Bo-TH@wrigleys.postgresql.org>
References: <E1SML0K-0007Bo-TH@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox