Em 13/08/08, ribafs<[EMAIL PROTECTED]> escreveu: > Interessante... > > Enviado para você por ribafs através do Google Reader: Hubert > Lubaczewski: NULLs vs. NOT IN() via ::Planet PostgreSQL:: em 13/08/08 > Friend of mine found something that he thought looked like a bug in Pg. > Very simple query: select * from table where id not in (select field > from other_table) was not returning any rows, despite the fact that > there definitely are some "ids" that are not in other_table.field. Why > is that? First, let's build a test case: CREATE TABLE objects [...] >
Ribamar: Talvez seja o caso descrito no manual: http://www.postgresql.org/docs/current/interactive/functions-subquery.html#AEN15302 "Note that if the left-hand expression yields null, or if there are no equal right-hand values and at least one right-hand row yields null, the result of the NOT IN construct will be null, not true. This is in accordance with SQL's normal rules for Boolean combinations of null values." A combinação de NULL com NOT IN nem sempre dá o resultado que usualmente (bom senso?) esperamos. Osvaldo _______________________________________________ pgbr-geral mailing list [email protected] https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
