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
<div class="WordSection1"><p class="MsoPlainText">Hi,<p class="MsoPlainText"> <p class="MsoPlainText">I am a newbie to
PostgreSQLand was wondering about the following behaviour.<p class="MsoPlainText"> <p class="MsoPlainText"> <p
class="MsoPlainText">SELECTtrue WHERE 1 = '1';     <-- Returns true <p class="MsoPlainText"> <p
class="MsoPlainText">SELECTtrue WHERE 1 BETWEEN '0' and '2';    <-- Returns true<p class="MsoPlainText"> <p
class="MsoPlainText">SELECTtrue WHERE 1 IS DISTINCT FROM '2';    <-- Returns true<p class="MsoPlainText"> <p
class="MsoPlainText">SELECTtrue WHERE 1 LIKE '1';   <-- Returns 'operator does not exist' Error<p
class="MsoPlainText"> <pclass="MsoPlainText">SELECT true WHERE '1' LIKE 1;   <-- Returns 'operator does not exist'
Error<pclass="MsoPlainText"> <p class="MsoPlainText"> <p class="MsoPlainText"> <p class="MsoPlainText">The first three
querieswork because of the implicit cast whereas the 'LIKE' is not using implicit cast. <p class="MsoPlainText"> <p
class="MsoPlainText">Canyou please help me understand why 'LIKE' does not use implicit cast ? <p class="MsoNormal"> <p
class="MsoNormal"> <pclass="MsoNormal"><span style="mso-fareast-language:EN-AU"> </span><p class="MsoNormal"><span
style="mso-fareast-language:EN-AU">BestRegards,</span><p class="MsoNormal"><span
style="mso-fareast-language:EN-AU">Vaishnavi</span><pclass="MsoNormal"> </div> 

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