Re: Is there a bug in PostgreSQL ?

From: "Pascal Tufenkji" <ptufenkji(at)usj(dot)edu(dot)lb>
To: "'Richard Huxton'" <dev(at)archonet(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Is there a bug in PostgreSQL ?
Date: 2008-12-11 09:33:30
Message-ID: 002d01c95b73$88116da0$150fa8c0@interne.usj.edu.lb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)archonet(dot)com]
Sent: Wednesday, December 10, 2008 7:45 PM
To: ptufenkji(at)usj(dot)edu(dot)lb
Cc: pgsql-sql(at)postgresql(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pascal Tufenkji 2008-12-11 09:57:36 Re: Is there a bug in PostgreSQL ?
Previous Message Jyoti Seth 2008-12-11 04:04:19 Re: unique constraint on views