Hi Berkus,

Thanks for your time and response.

I do understand that there is no LIKE operator support for integers and it 
would be great if you could help me understand the reason why is it not 
supported.

My intention is to know whether this is not supported because of any technical 
limitation or is it against any Postgresql/SQL standards. 

My use cases are like below ones :
Integer LIKE pattern [ESCAPE escape-character] 
1. List all the customers who are having negative balance:
SELECT * from Customer where balance LIKE ‘-%’

2. List all the customers whose id starts with 1:
SELECT * from Customer where cust_id LIKE ‘1%’

Thanks & Regards,
Vaishnavi


-----Original Message-----
From: pgsql-hackers-ow...@postgresql.org 
[mailto:pgsql-hackers-ow...@postgresql.org] On Behalf Of Josh Berkus
Sent: Wednesday, 10 July 2013 9:13 AM
To: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Differences in WHERE clause of SELECT

Prabakaran,


> I am a newbie to PostgreSQL and was wondering about the following 
> behaviour.

pgsql-hackers is not the appropriate list for this kind of question.  In the 
future, please post to pgsql-novice, pgsql-sql, or pgsql-general with this kind 
of question.  Thanks.

> Can you please help me understand why 'LIKE' does not use implicit 
> cast ?

Like uses the operator class "text_pattern_ops" which doesn't include an 
implict cast.  For one thing, the implicit cast is from text --> integer, not 
the other way around, and there is no LIKE operator for integers.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to