Re: Is there a bug in PostgreSQL ? - Mailing list pgsql-sql

From Pascal Tufenkji
Subject Re: Is there a bug in PostgreSQL ?
Date
Msg-id 002d01c95b73$88116da0$150fa8c0@interne.usj.edu.lb
Whole thread Raw
In response to Re: Is there a bug in PostgreSQL ?  (Richard Huxton <dev@archonet.com>)
Responses Re: Is there a bug in PostgreSQL ?
List pgsql-sql

Hello again,

 

Actually I'm using PostgreSQL 8.2.4

 

By the way, I tried reindexing the tables but the problem remains

REINDEX TABLE sip_carriere_dates;

REINDEX TABLE sip_carriere;

 

I also made a pg_dump of the database and then restored it in a test one, the queries run perfectly well but it gives an error when I add the condition with the operator is null, for example:

 

dragon_test=# 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 = 2700 ;

 emp_id | institution | emp_id | demission_date

--------+-------------+--------+----------------

   2700 |          11 |        |

   2700 |          52 |        |

(2 rows)

 

dragon_test=# 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 = 2700 and d.emp_id is null;

 emp_id | institution | emp_id | demission_date

--------+-------------+--------+----------------

(0 rows)

 

Also, when I run the following command to vacuum all the databases : /usr/local/pgsql/bin/vacuumdb -a -f -z -v -U pascal

All the queries become busted again

 

Weird, isn’t it ????!!!!!

 

I’d appreciate any help

Pascal

 

 

-----Original Message-----
From: Richard Huxton [mailto:dev@archonet.com]
Sent: Wednesday, December 10, 2008 7:45 PM
To: ptufenkji@usj.edu.lb
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Is there a bug in PostgreSQL ?

 

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 by date:

Previous
From: "Jyoti Seth"
Date:
Subject: Re: unique constraint on views
Next
From: "Pascal Tufenkji"
Date:
Subject: Re: Is there a bug in PostgreSQL ?