Re: No error when FROM is missing in subquery - Mailing list pgsql-bugs

From Thomas H.
Subject Re: No error when FROM is missing in subquery
Date
Msg-id 081701c7232a$c9267d90$6601a8c0@iwing
Whole thread Raw
In response to No error when FROM is missing in subquery  ("Nikolay Samokhvalov" <samokhvalov@gmail.com>)
Responses Re: No error when FROM is missing in subquery
List pgsql-bugs
>> >> SELECT * FROM movies.names WHERE mov_id IN (SELECT DISTINCT mov_id
>> >> WHERE
>> >> mov_name like '%, %' LIMIT 2)
>>
>> IF the subquery would only have returned 2 ids, then there would be at
>> most
>> like +/-10 records affected. each mov_id can hold one or more (usuals up
>> to
>> 5) names. but here, the subquery seemed to return ~3700 distinct mov_ids,
>> thus around 37000 names where damaged by the following programmatical
>> updates instead of only a hands full...
>>
>
> have you tested the query in psql?
> what results do you get?

the data is damaged so the result isn't the same... regenearting it now from
a backup.

from first tests i would say it returned records with names that match the
WHERE in the subselect. i guess what happened is: it took each record in
movies.names, then run the subquery for that record which resulted in "WHERE
mov_id IN (mov_id)" = true for records with a ', ' in the name and "WHERE
mov_id IN ()" = false for all others.

- thomas

pgsql-bugs by date:

Previous
From: "Jaime Casanova"
Date:
Subject: Re: No error when FROM is missing in subquery
Next
From: Tom Lane
Date:
Subject: Re: BUG #2837: i received ERROR: failed to build any 7-way joins