понедельник, 12 апреля 2010 г.

duplicate key value violates unique constraint

PGError: ERROR: duplicate key value violates unique constraint "lastsearches_pkey"

Фиксим выполнив
select setval('lastsearches_id_seq', (select max(id) + 1 from lastsearches));
И все - заработало.
Еще один вариант REINDEX INDEX lastsearches_pkey;

обезьяний патчик

начала валиться ошибка

dima@~/project/mp3cms$ rake db:migrate --trace
(in /home/dima/project/mp3cms)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
cannot remove Object::ClassMethods
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:603:in `remove_const'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:603:in `remove_constant'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:603:in `instance_eval'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:603:in `remove_constant'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:549:in `new_constants_in'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_suppor/dependencies.rb:549:in `each'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:549:in `new_constants_in'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'


все перепробовал

В итоге тупо не делаем действие при Object::ClassMethods
unless names.last.to_s =~ /ClassMethods/
parent।instance_eval { remove_const names।last }
end


Оказывается вся проблема в delayed_job второй версии
после сноса версии 2.0.2 и установке 1.8.5 все прекрасно заработало