Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Postgres SchemaDumper does not preserve composite index column order

#2562

The schema dumper used by the PostgreSQL adapter does not preserve column order for composite keys. It issues a query against internal Postgres tables and does no further sorting. While this leaves it up to the DB to decide, I've found that Postgres 8.3 on MacOS X seems to return in attribute number ascending order. So, the problem wouldn't appear if every subsequent column in the index appeared later than all previous ones in the table definition. If the columns used in the index are not in the same sequential ordering as the table definition, the dumped "add_index" line is wrong.

While looking into this code, too, I noticed an artificial upper limit on the number of columns in composite indices. As of 8.3, Postgres allows up to 32 columns. The PostgreSQL adapter, however, caps this at 10.

Reported by Kevin Menard · April 24th, 2009 @ 10:15 PM

State: duplicate
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Kevin Menard
    Kevin Menard

    Nevermind. This is a duplicate of #2515 db:schema:dump with PostgreSQLAdapter dumps multiple column indexes in undefi... and has already been fixed. I came across the problem before that ticket was opened and didn't get to really investigate until just now.

    April 24th, 2009 @ 10:31 PM

  2. CancelProfileIsBroken
    CancelProfileIsBroken
    • State changed from new to duplicate

    April 24th, 2009 @ 10:43 PM