Problem with complex join

Поиск
Список
Период
Сортировка
От Oleg Broytmann
Тема Problem with complex join
Дата
Msg-id Pine.SOL2.3.96.SK.990222181830.6787A-100000@sun.med.ru
обсуждение исходный текст
Список pgsql-hackers
Hi!
  I ran a query:
SELECT p.subsec_id, p.pos_id, cn.pos_id  FROM central cn, shops sh, districts d, positions p     WHERE cn.shop_id =
sh.shop_idAND sh.distr_id = d.distr_id     AND   d.city_id = 1 ;
 

and got a huge list, where, are, e.g:
subsec_id|pos_id|pos_id
---------+------+------       1|     1|     1       1|     1|     1       1|     1|     1       1|     1|     1
[skipped]      1|     2|     1       1|     2|     2       1|     2|     2       1|     2|     2
 

and so on.
  I modified the query to exclude rows:

SELECT p.subsec_id, p.pos_id, cn.pos_id  FROM central cn, shops sh, districts d, positions p     WHERE cn.shop_id =
sh.shop_idAND sh.distr_id = d.distr_id     AND   d.city_id = 1 AND cn.pos_id = p.pos_id ;
 

but got 0 rows as a result. I expected:
subsec_id|pos_id|pos_id
---------+------+------       1|     1|     1  [skipped]       1|     2|     2
  Is it a bug?

Oleg.
----    Oleg Broytmann     http://members.xoom.com/phd2/     phd2@earthling.net          Programmers don't die, they
justGOSUB without RETURN.
 



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Daryl W. Dunbar"
Дата:
Сообщение: RE: [HACKERS] Re: Max backend limits cleaned up
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] optimizer cleanup