Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 8DA4114E23D5 for ; Wed, 21 Dec 2011 15:18:18 -0400 (AST) Received: from mahout.postgresql.org ([98.129.198.123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RdRg6-0003u3-RQ for pgsql-bugs@postgresql.org; Wed, 21 Dec 2011 19:18:18 +0000 Received: from [204.145.120.229] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RdRfu-0004e9-GA for pgsql-bugs@postgresql.org; Wed, 21 Dec 2011 19:18:02 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1RdRfu-0004E9-8N for pgsql-bugs@postgresql.org; Wed, 21 Dec 2011 19:18:02 +0000 Date: Wed, 21 Dec 2011 19:18:02 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6351: ERROR: btree index keys must be ordered by attribute To: pgsql-bugs@postgresql.org From: christian_oederan@gmx.de X-Pg-Spam-Score: -4.5 (----) X-Archive-Number: 201112/198 X-Sequence-Number: 32009 The following bug has been logged on the website: Bug reference: 6351 Logged by: Christian Rudolph Email address: christian_oederan@gmx.de PostgreSQL version: 9.0.6 Operating system: openSUSE Description: = Hi, our OR-Mapper accidently created an index that contained the same column twice, with the result that some SELECTs could not be executed anymore and gave the error message "btree index keys must be ordered by attribute". The problem can be reproduced with a new table every time: CREATE TABLE tab (id SERIAL, a INTEGER, b INTEGER); CREATE INDEX tab123 ON tab (a, b, a); SELECT a, b FROM tab WHERE a =3D 0 AND b =3D 0; ERROR: XX000: btree index keys must be ordered by attribute LOCATION: _bt_preprocess_keys, nbtutils.c:322 For me the error occured without inserting any rows. The database was compiled from source using the switches --with-tcl --with-perl and --with-python. SELECT version(); PostgreSQL 9.0.6 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.2.1 (SUSE Linux), 32-bit Thanks, Christian