Re: Differences in WHERE clause of SELECT

From: "Prabakaran, Vaishnavi" <vaishnavip(at)fast(dot)au(dot)fujitsu(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>, Josh Berkus <josh(at)agliodbs(dot)com>
Subject: Re: Differences in WHERE clause of SELECT
Date: 2013-07-11 01:42:56
Message-ID: A09FCFD6831B314F9793FEE2D9615B8123BF@ack0102.au.fjanz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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-owner(at)postgresql(dot)org [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Josh Berkus
Sent: Wednesday, 10 July 2013 9:13 AM
To: pgsql-hackers(at)postgresql(dot)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(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jaime Casanova 2013-07-11 02:50:10 Re: Differences in WHERE clause of SELECT
Previous Message Troels Nielsen 2013-07-11 01:38:02 Re: SSL renegotiation