# Default value based on sequence

**URL:** <https://forum.liquibase.org/t/default-value-based-on-sequence/391>\
**Category:** General Discussion\
**Created:** [December 9, 2009, 2:32am UTC](https://forum.liquibase.org/t/default-value-based-on-sequence/391 "2009-12-09T02:32:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![djantzen](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@djantzen](https://forum.liquibase.org/u/djantzen)\
**Post date:** [December 9, 2009, 2:32am UTC](https://forum.liquibase.org/t/default-value-based-on-sequence/391/1 "2009-12-09T02:32:00Z")

</div>

I’m trying to set a default value based on a sequence, and having trouble. &nbsp;In this case the ‘serial’ datatype isn’t going to work. &nbsp;

When I use defaultValue the apostrophes are escaped, and Postgres complains:

 &nbsp; &nbsp; &nbsp; 

When I use defaultNumericValue I get Unparseable number: “nextval(‘my\_id\_seq’”. &nbsp;Is there a workaround here besides raw SQL?

Thanks!

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [December 9, 2009, 2:32am UTC](https://forum.liquibase.org/t/default-value-based-on-sequence/391/2 "2009-12-09T02:32:00Z")

</div>

In 1.9 there isn’t a way besides raw SQL.&nbsp; 2.0 introduces a new “defaultValueComputed” attribute that will work.

Nathan

---

<div class="post-metadata">

**Author:** ![djantzen](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@djantzen](https://forum.liquibase.org/u/djantzen)\
**Post date:** [December 9, 2009, 2:32am UTC](https://forum.liquibase.org/t/default-value-based-on-sequence/391/3 "2009-12-09T02:32:00Z")

</div>

Ok, thanks Nathan.
