Re: Odd query behavior

From: silly sad <sad(at)bankir(dot)ru>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Odd query behavior
Date: 2010-03-15 11:27:17
Message-ID: 4B9E1995.2060008@bankir.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 03/12/10 18:41, Dan McFadyen wrote:
> Hello,
>
> I've come across an odd situation. I've had access to a database where a
> the following happens:
>
> " SELECT * FROM table WHERE name LIKE 'abc%' " returns 2 rows...
>
> but...
>
> " SELECT * FROM table WHERE name IN (SELECT name FROM table WHERE name
> LIKE 'abc%') " returns 0 rows...

I am sorry if it was already spoken.

SELECT name FROM table WHERE name LIKE 'abc%'

EXPLAIN SELECT name FROM table WHERE name LIKE 'abc%'

EXPLAIN SELECT * FROM table WHERE name IN
(SELECT name FROM table WHERE name LIKE 'abc%')

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2010-03-15 15:03:59 Re: Odd query behavior
Previous Message silly sad 2010-03-15 06:25:21 Re: Private functions