Re: Is there a bug in PostgreSQL ?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Is there a bug in PostgreSQL ?
Дата
Msg-id 49400022.7000803@archonet.com
обсуждение исходный текст
Ответ на Is there a bug in PostgreSQL ?  ("Pascal Tufenkji" <ptufenkji@usj.edu.lb>)
Ответы Re: Is there a bug in PostgreSQL ?  ("Pascal Tufenkji" <ptufenkji@usj.edu.lb>)
Список pgsql-sql
Pascal Tufenkji wrote:
> 
> SELECT distinct c.emp_id,c.institution,d.* from sip_carriere c left join
> sip_demissionaire d on d.emp_id = c.emp_id where c.emp_id = 342 ;
[snip - rows]
> 
> SELECT distinct c.emp_id,c.institution,d.* from sip_carriere c left join
> sip_demissionaire d on d.emp_id = c.emp_id where c.institution = 1;
[snip - rows]
> 
> BUT IF I PUT BOTH CONDITIONS
> 
>  
> 
> SELECT distinct c.emp_id,c.institution,d.* from sip_carriere c left join
> sip_demissionaire d on d.emp_id = c.emp_id where c.emp_id = 342 and
> c.institution = 1;
[snip - no rows]

> What's the problem ?
> 
> I'm sure that the problem is with the view "sip_demissionaire" cause when I
> copied its content to a temp table, the query returned a result.

> SELECT * into temp foo from sip_demissionaire ;
> 
> SELECT distinct c.emp_id,c.institution,d.* from sip_carriere c left join foo
> d on d.emp_id = c.emp_id where c.emp_id = 342 and c.institution = 1;

Good testing. It looks to me like you have a corrupted index. If you run
EXPLAIN ANALYSE SELECT ... for each of your queries, you'll probably see
that the one that returns no rows is using a particular index that the
other queries aren't.

Have you had any crashes / power failures / disk errors recently?

Oh - and what version of PostgreSQL is this?

--  Richard Huxton Archonet Ltd


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Is there a bug in PostgreSQL ?
Следующее
От: Bryce Nesbitt
Дата:
Сообщение: Re: Best way to "and" from a one-to-many joined table?