Kamil Kukura
2006-Feb-09 07:52 UTC
[Rails] migration with PostgreSQL - function nextval does not exist
This might be a problem with postgresql, but I''m not sure. In a migration I have renamed a table so I wanted to rename a sequencer as well. It looks like: execute "ALTER TABLE global_vacations_id_seq RENAME TO vacations_id_seq;" execute "ALTER TABLE vacations ALTER COLUMN id SET DEFAULT nextval(''vacations_id_seq''::regclass);" But the process of migration has reported error: PGError: ERROR: function nextval(regclass) does not exist Funny part is that running "rake migrate" once again didn''t give this error again. It also has crashed, but because of errors from having the migration already ran only on half of file. Anyone has experienced something like this? -- Kamil
Lugovoi Nikolai
2006-Feb-09 08:19 UTC
[Rails] migration with PostgreSQL - function nextval does not exist
postgresql before 8.1 does not have function nextval(regclass), but nextval( text). On 2/9/06, Kamil Kukura <kamil.kukura@virtua.cz> wrote:> This might be a problem with postgresql, but I''m not sure. In a > migration I have renamed a table so I wanted to rename a sequencer as > well. It looks like: > > execute "ALTER TABLE global_vacations_id_seq RENAME TO vacations_id_seq;" > execute "ALTER TABLE vacations ALTER COLUMN id SET DEFAULT > nextval(''vacations_id_seq''::regclass);" > > But the process of migration has reported error: > PGError: ERROR: function nextval(regclass) does not exist > > Funny part is that running "rake migrate" once again didn''t give this > error again. It also has crashed, but because of errors from having the > migration already ran only on half of file. Anyone has experienced > something like this? > > -- > Kamil > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >