[SQL] Odd query behavior

2010-03-15 Thread Dan McFadyen
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...

Re: [SQL] Odd query behavior

2010-03-15 Thread Dan McFadyen
5, 2010 11:04 AM To: Dan McFadyen Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Odd query behavior "Dan McFadyen" writes: > You're right, the second one does use an index, one that is used to > enforce a unique constraint on the column. I wasn't able to turn it off &

[SQL] Odd query behavior

2010-03-12 Thread Dan McFadyen
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...