# Migration with PostgreSQL - function nextval does not exist

**URL:** <https://www.ruby-forum.com/t/migration-with-postgresql-function-nextval-does-not-exist/64946>\
**Category:** Rails\
**Created:** [February 9, 2006, 8:53am UTC](https://www.ruby-forum.com/t/migration-with-postgresql-function-nextval-does-not-exist/64946 "2006-02-09T08:53:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kamil\_Kukura](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/cab0a1/32.png) [@Kamil\_Kukura](https://www.ruby-forum.com/u/Kamil_Kukura)\
**Post date:** [February 9, 2006, 8:53am UTC](https://www.ruby-forum.com/t/migration-with-postgresql-function-nextval-does-not-exist/64946/1 "2006-02-09T08:53:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kamil\_Kukura](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/cab0a1/32.png) [@Kamil\_Kukura](https://www.ruby-forum.com/u/Kamil_Kukura)\
**Post date:** [February 9, 2006, 9:19am UTC](https://www.ruby-forum.com/t/migration-with-postgresql-function-nextval-does-not-exist/64946/2 "2006-02-09T09:19:51Z")

</div>

postgresql before 8.1 does not have function nextval(regclass),  
but nextval( text).
