Re: No error when FROM is missing in subquery

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Thomas H(dot)" <me(at)alternize(dot)com>
Cc: "Jaime Casanova" <systemguards(at)gmail(dot)com>, nikolay(at)samokhvalov(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: No error when FROM is missing in subquery
Date: 2006-12-19 05:19:43
Message-ID: 13478.1166505583@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Thomas H." <me(at)alternize(dot)com> writes:
> SELECT * FROM movies.names WHERE mov_id IN (SELECT DISTINCT mov_id WHERE
> mov_name like '%, %' LIMIT 2)

> the subselect is missing a FROM <table>. in that case, pgsql seemed to also
> ignore the LIMIT 2

It didn't "ignore" anything. Each execution of the sub-select returned
1 row, containing the current mov_id from the outer query. So basically
this would've selected everything passing the LIKE condition.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message mike 2006-12-19 05:40:18 Re: No error when FROM is missing in subquery
Previous Message Tom Lane 2006-12-19 05:13:01 Re: BUG #2837: i received ERROR: failed to build any 7-way joins