Differences in WHERE clause of SELECT - Mailing list pgsql-hackers

From Prabakaran, Vaishnavi
Subject Differences in WHERE clause of SELECT
Date
Msg-id A09FCFD6831B314F9793FEE2D9615B81239B@ack0102.au.fjanz.com
Whole thread Raw
List pgsql-hackers

Hi,

 

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

 

 

SELECT true WHERE 1 = '1';     <-- Returns true

 

SELECT true WHERE 1 BETWEEN '0' and '2';    <-- Returns true

 

SELECT true WHERE 1 IS DISTINCT FROM '2';    <-- Returns true

 

SELECT true WHERE 1 LIKE '1';   <-- Returns 'operator does not exist' Error

 

SELECT true WHERE '1' LIKE 1;   <-- Returns 'operator does not exist' Error

 

 

 

The first three queries work because of the implicit cast whereas the 'LIKE' is not using implicit cast.

 

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

 

 

 

Best Regards,

Vaishnavi

 

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Review: extension template
Next
From: Josh Berkus
Date:
Subject: Re: Differences in WHERE clause of SELECT