pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #6351: ERROR: btree index keys must be ordered by attribute
3+ messages / 3 participants
[nested] [flat]
* BUG #6351: ERROR: btree index keys must be ordered by attribute
@ 2011-12-21 19:18 christian_oederan@gmx.de
2011-12-22 16:27 ` Re: BUG #6351: ERROR: btree index keys must be ordered by attribute Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: christian_oederan@gmx.de @ 2011-12-21 19:18 UTC (permalink / raw)
To: pgsql-bugs
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 = 0 AND b = 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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #6351: ERROR: btree index keys must be ordered by attribute
2011-12-21 19:18 BUG #6351: ERROR: btree index keys must be ordered by attribute christian_oederan@gmx.de
@ 2011-12-22 16:27 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-12-23 12:30 ` Re: BUG #6351: ERROR: btree index keys must be ordered by attribute Christian Rudolph <Christian_Oederan@gmx.de>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2011-12-22 16:27 UTC (permalink / raw)
To: christian_oederan@gmx.de; +Cc: pgsql-bugs
christian_oederan@gmx.de writes:
> 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 = 0 AND b = 0;
> ERROR: XX000: btree index keys must be ordered by attribute
Hmm. This didn't use to be allowed at all before 9.0; previous releases
would reject the index definition:
regression=# CREATE INDEX tab123 ON tab (a, b, a);
ERROR: duplicate key value violates unique constraint "pg_attribute_relid_attnam_index"
But now that we allow it it'd be nice if it actually worked :-(.
Looking into the archives I see that we were mainly thinking about
the possibility of exclusion constraints naming the same column
more than once, which may explain why nobody tried using such an
index for queries. I'll see about fixing this in HEAD, although
my initial guess is that it will be too invasive to back-patch.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #6351: ERROR: btree index keys must be ordered by attribute
2011-12-21 19:18 BUG #6351: ERROR: btree index keys must be ordered by attribute christian_oederan@gmx.de
2011-12-22 16:27 ` Re: BUG #6351: ERROR: btree index keys must be ordered by attribute Tom Lane <tgl@sss.pgh.pa.us>
@ 2011-12-23 12:30 ` Christian Rudolph <Christian_Oederan@gmx.de>
0 siblings, 0 replies; 3+ messages in thread
From: Christian Rudolph @ 2011-12-23 12:30 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs
> But now that we allow it it'd be nice if it actually worked :-(.
> Looking into the archives I see that we were mainly thinking about
> the possibility of exclusion constraints naming the same column
> more than once, which may explain why nobody tried using such an
> index for queries. I'll see about fixing this in HEAD, although
> my initial guess is that it will be too invasive to back-patch.
I didn't recognized the exclusion constraint feature before. But it looks interesting.
Thank you for your effort.
Christian
--
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
Jetzt informieren: http://www.gmx.net/de/go/freephone
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2011-12-23 12:30 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-12-21 19:18 BUG #6351: ERROR: btree index keys must be ordered by attribute christian_oederan@gmx.de
2011-12-22 16:27 ` Re: BUG #6351: ERROR: btree index keys must be ordered by attribute Tom Lane <tgl@sss.pgh.pa.us>
2011-12-23 12:30 ` Re: BUG #6351: ERROR: btree index keys must be ordered by attribute Christian Rudolph <Christian_Oederan@gmx.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox