Re: Duplicate primary keys/rows

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: CSN <cool_screen_name90001(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Duplicate primary keys/rows
Date: 2005-10-09 23:13:59
Message-ID: 20051009231359.GA59196@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Oct 09, 2005 at 12:46:51PM -0700, CSN wrote:
> select * from table1 where id=586;
> 586|a|b|c|d

Do you get different results from the following queries?

SET enable_seqscan TO on;
SET enable_indexscan TO off;
SELECT * FROM table1 WHERE id = 586;

SET enable_seqscan TO off;
SET enable_indexscan TO on;
SELECT * FROM table1 WHERE id = 586;

> Yet:
> select * from table1 where id>=585 and id<=587;
> 585|c|a|e|f
> 586|a|b|c|d
> 586|a|b|c|d
> 587|g|e|r|z

What's the output of the following query?

RESET enable_seqscan;
RESET enable_indexscan;

SELECT oid, ctid, xmin, cmin, xmax, cmax, *
FROM table1
WHERE id >= 585 AND id <= 587;

If you get the error 'column "oid" does not exist' then you've
created the table without oids, so just omit oid from the select
list:

SELECT ctid, xmin, cmin, xmax, cmax, *
FROM table1
WHERE id >= 585 AND id <= 587;

> Wow, how is this possible? I'm using PG 8.0.3 on
> Windows XP. This computer has been crashing repeatedly
> lately, if that could be blamed (bad memory? hard
> disk? I haven't quite figured out why.)

Faulty hardware is one possibile explanation.

--
Michael Fuhr

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rick Morris 2005-10-10 01:44:16 Re: Oracle buys Innobase
Previous Message CSN 2005-10-09 19:46:51 Duplicate primary keys/rows