The following bug has been logged on the website:
Bug reference: 8576
Logged by: Peter Hicks
Email address: peter.hicks@poggs.co.uk
PostgreSQL version: 9.1.10
Operating system: Ubuntu 12.04
Description:
Hello
The SQL code further down allows a btree index to be created with the same
column twice, however no queries are possible on the table and are met with
a "ERROR: XX000: btree index keys must be ordered by attribute".
This problem is reproducible on a newly created database on both 9.1.9 and
9.1.10 (9.1.10-0ubuntu12.04), and isn't present on 9.2.4 (OS X/Homebrew).
It looks like bug #6351
(http://www.postgresql.org/message-id/E1RdRfu-0004E9-8N@wrigleys.postgresql.org)
- was this ever fixed for 9.1.x?
DROP TABLE IF EXISTS scenario;
CREATE TABLE scenario
(
id serial NOT NULL,
f1 character varying(1),
f2 character varying(1)
);
CREATE INDEX index_scenario
ON scenario
USING btree
(f1, f2, f1);
SELECT COUNT(*) FROM scenario WHERE "f1" = 'A' AND "f2" = 'B';
---
Peter