Re: Duplicate primary keys/rows - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Duplicate primary keys/rows
Date
Msg-id 20051009231359.GA59196@winnie.fuhr.org
Whole thread Raw
In response to Duplicate primary keys/rows  (CSN <cool_screen_name90001@yahoo.com>)
Responses Re: Duplicate primary keys/rows  (CSN <cool_screen_name90001@yahoo.com>)
List 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

pgsql-general by date:

Previous
From: CSN
Date:
Subject: Duplicate primary keys/rows
Next
From: Rick Morris
Date:
Subject: Re: Oracle buys Innobase