[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 Tom Lane
"Dan McFadyen" writes: > Now, the interesting part is for all I can tell, there are no special > characters in the field. Unless the latest version of Pgadmin (1.10.1 or > 1.10.2) hides this from the UI, either that or it's some character that > renders into a similar glyph as ASCII. > Is there a

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 &

Re: [SQL] Odd query behavior

2010-03-15 Thread Tom Lane
"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 > as the database is currently in use, and disabling a unique constraint > probably isn't a good idea. > Sorry for not mentioning

Re: [SQL] Odd query behavior

2010-03-15 Thread silly sad
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 'ab

Re: [SQL] Odd query behavior

2010-03-12 Thread Tom Lane
"Dan McFadyen" writes: > I've come across an odd situation. I've had access to a database where a > the following happens: What are the plans for the two queries? If either one involves use of an index, does disabling the index change the results? > I do know that server it was running on was F

Re: [SQL] Odd query behavior

2010-03-12 Thread Rob Sargent
Any views involved, or separate users/roles? On 03/12/2010 08:41 AM, 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... > > >

[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...