This project is archived and is in readonly mode.
AR::Migrations not quoting index names?
Reported by James B. Byrne | April 2nd, 2009 @ 11:15 PM | in 2.x
Rails 2.3.2 gem
PostgreSQL 8.3.7
Situation:
Given a migration containing an index name with mixed case f.e. (idxU_name)
And given the DB adapter is postgresql
When rake db:migrate is run
Then the index idxU_name is created
When rake db:migrate VERSION=0 is run
Then the mirgration attempts to remove an index named idxu_name, which fails.
#db/migrate/x_create_sessions.rb def self.up ... add_index :sessions, :updated_at, :name => :idxR_sessions_updated_at, :unique => false end def self.down remove_index :sessions, :name => :idxR_sessions_updated_at ... # rake db:migrate VERSION=0 == CreateSessions: reverting ================================================= -- remove_index(:sessions, {:name=>:idxR_sessions_updated_at}) rake aborted! An error has occurred, this and all later migrations canceled: PGError: ERROR: index "idxr_sessions_updated_at" does not exist : DROP INDEX idxR_sessions_updated_at
Note the lack of quotes around the DROP argument. PostgreSQl will lowercase all arguments unless they are enclosed in quotes.
Comments and changes to this ticket
-
Jeff April 5th, 2009 @ 09:43 PM
- Tag changed from active_record, bug, defect, migrations, postgresql to active_record, bug, defect, migrations, patch, postgresql
this should cover it
-
Max Lapshin April 20th, 2009 @ 05:10 PM
- Tag changed from active_record, bug, defect, migrations, patch, postgresql to 2.3.2, active_record, bug, defect, index, migrations, patch, postgresql, test
- Assigned user set to Tarmo Tänav
I've added failing test and fixed remove_index in Postgres adapter. Previous patch didn't handled issue, when multischema environment, but I've used my previous patches and fixed this issue.
-
Repository April 21st, 2009 @ 11:51 AM
- State changed from new to resolved
(from [cdcd638c2f27ebf98ba7aa59512547f58a5e0c61]) Fixed wrong quoting of index names in postgres [#2402 state:resolved]
Signed-off-by: Tarmo Tänav tarmo@itech.ee http://github.com/rails/rails/co...
-
Repository April 21st, 2009 @ 11:52 AM
(from [de4cc53f7428090600b9e31ee39cf8c4c0df811e]) Fixed wrong quoting of index names in postgres [#2402 state:resolved]
Signed-off-by: Tarmo Tänav tarmo@itech.ee http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 2402 AR::Migrations not quoting index names? (from [cdcd638c2f27ebf98ba7aa59512547f58a5e0c61]) Fixed w...
- 2402 AR::Migrations not quoting index names? (from [de4cc53f7428090600b9e31ee39cf8c4c0df811e]) Fixed w...