dbsrgits / sql-translator

SQL::Translator (SQLFairy)
http://sqlfairy.sourceforge.net/
82 stars 91 forks source link

Fix bug loading Postgres index fields #153

Closed nrdvana closed 1 year ago

nrdvana commented 1 year ago

When parsing indices of a table, the Parser::DBI::PostgreSQL makes an incorrect assumption that the numeric field references refer to the current column order. This breaks if the table has had any columns deleted, because Postgres does not re-number the columns, so the column (attribute ids) might be (1,2,4,6,7) and these are the numbers that need used.

The code already retrieved the ids of the columns, so just store them in a hash and use them instead of the column name list.

rabbiveesh commented 1 year ago

Thanks! Let me review the other pending release stuff and then I'll cut a release