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>
Subject: Differences in WHERE clause of SELECT
Date: 2013-07-09 22:53:17
Message-ID: A09FCFD6831B314F9793FEE2D9615B81239B@ack0102.au.fjanz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2013-07-09 23:12:37 Re: Differences in WHERE clause of SELECT
Previous Message Peter Eisentraut 2013-07-09 21:04:05 Re: Review: extension template