Juan Francisco Diaz <j-diaz@publicar.com> writes:
> When i need it executed, the subquery returns 0 rows, maybe th if condition
> is false because the not in operator does not 'work' if there are 0 rows...
More likely, you have some null values in the sub-select. NOT IN has
fairly unintuitive behavior in the presence of nulls. See the manual.
regards, tom lane