Re: 9.0b1: "ERROR: btree index keys must be ordered by attribute"

From: Ian Barwick <barwick(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 9.0b1: "ERROR: btree index keys must be ordered by attribute"
Date: 2010-05-10 00:46:48
Message-ID: g2j1d581afe1005091746g3309b285l31eccad3031ed28f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

2010/5/10 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Ian Barwick <barwick(at)gmail(dot)com> writes:
>> 2010/5/9 David Fetter <david(at)fetter(dot)org>:
>>> A self-contained way to reproduce this, ideally small, would be
>>> fantastic :)
>
> s/fantastic/absolutely required to do anything with this report/

Yes, I appreciate that :) I am a bit pressed for time and as googling
the error message didn't produce any kind of result I thought
it better to at least give a heads-up on the offchance someone
might be able to do something with it as is, and / or events
overtake me and I never end up doing anything about it at all.

"Luckily" this is easy to reproduce with a stripped-down version
of the original table and minimal data set:

CREATE TABLE object_version (
object_version_id SERIAL,
object_id INT NOT NULL,
version INT NOT NULL DEFAULT 0,
object_status_id INT NOT NULL,
parent_id INT DEFAULT NULL,
owner_id INT NOT NULL,
created TIMESTAMP(0) NOT NULL DEFAULT NOW(),
lang CHAR(2) NOT NULL,
PRIMARY KEY (object_version_id),
UNIQUE (object_id, version, object_status_id, lang)
);

INSERT INTO object_version VALUES
(DEFAULT, 1, 0, 0, NULL, 1, DEFAULT,'en'),
(DEFAULT, 1, 0, -1, NULL, 1, DEFAULT,'en'),
(DEFAULT, 1, 1, -1, NULL, 1, DEFAULT,'en');

SELECT ov.object_id
FROM object_version ov
WHERE ov.object_id = 1
AND ov.version ='0
AND ov.object_status_id = (
SELECT MAX(ov1.object_status_id)
FROM object_version ov1
WHERE ov1.object_id=ov.object_id
AND ov1.version = ov.version
AND ov1.lang = ov.lang
)
AND ov.lang = 'en';

SELECT version();
PostgreSQL 9.0beta1 on x86_64-unknown-linux-gnu, compiled by GCC gcc
(Ubuntu 4.4.1-4ubuntu9) 4.4.1, 64-bit

HTH

Ian Barwick

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ian Barwick 2010-05-10 00:55:13 Re: 9.0b1: "ERROR: btree index keys must be ordered by attribute"
Previous Message Andres Freund 2010-05-09 22:58:30 Re: max_standby_delay considered harmful