pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: silly sad <sad@bankir.ru>
To: pgsql-sql@postgresql.org
Subject: Re: Odd query behavior
Date: Mon, 15 Mar 2010 14:27:17 +0300
Message-ID: <4B9E1995.2060008@bankir.ru> (raw)
In-Reply-To: <BA48DC793F18724D862C27C8F2C131CC62094F@exchange03.cryptocard.internal>
References: <BA48DC793F18724D862C27C8F2C131CC62094F@exchange03.cryptocard.internal>

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%')





view thread (8+ messages)  latest in thread

Message-ID: <4B9E1995.2060008@bankir.ru>
Permalink:  ../4B9E1995.2060008@bankir.ru/
Also on:    postgresql.org/message-id/4B9E1995.2060008@bankir.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sad@bankir.ru
  Subject: Re: Odd query behavior
  In-Reply-To: <4B9E1995.2060008@bankir.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox