# Active\_record postgresql adapter problem

**URL:** <https://www.ruby-forum.com/t/active-record-postgresql-adapter-problem/75314>\
**Category:** Rails\
**Created:** [March 1, 2006, 6:19pm UTC](https://www.ruby-forum.com/t/active-record-postgresql-adapter-problem/75314 "2006-03-01T18:19:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 1, 2006, 6:19pm UTC](https://www.ruby-forum.com/t/active-record-postgresql-adapter-problem/75314/1 "2006-03-01T18:19:12Z")

</div>

Instead of using numeric I created the field “unit\_price” as PostgreSQL  
type money. Now when I try and add a row I get the following. How do I  
override AR default behaviour to cast numeric post data to money, or am  
I forced to only support database types that active\_record knows about?

RuntimeError: ERROR C42804 Mcolumn “unit\_price” is of type money but  
expression is of type numeric HYou will need to rewrite or cast the  
expression. Fparse\_target.c L361 RupdateTargetListEntry: INSERT INTO  
line\_items (“order\_id”, “product\_id”, “quantity”, “unit\_price”)  
VALUES(1, 3, 1.0, 5367829.95)

Regards,  
Jim

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 1, 2006, 6:45pm UTC](https://www.ruby-forum.com/t/active-record-postgresql-adapter-problem/75314/2 "2006-03-01T18:45:32Z")

</div>

Jeremy K. wrote:

> On Mar 1, 2006, at 9:19 AM, James B. wrote:

> MONEY is deprecated. You work with it as a string, not a number.
> 
> Use NUMERIC instead.
> 
> Best,  
> jeremy

Done, Works, Thanks.

Jim

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 1, 2006, 6:22pm UTC](https://www.ruby-forum.com/t/active-record-postgresql-adapter-problem/75314/3 "2006-03-01T18:22:24Z")

</div>

On Mar 1, 2006, at 9:19 AM, James B. wrote:

> expression is of type numeric HYou will need to rewrite or cast the  
> expression. Fparse\_target.c L361 RupdateTargetListEntry: INSERT INTO  
> line\_items (“order\_id”, “product\_id”, “quantity”, “unit\_price”)  
> VALUES(1, 3, 1.0, 5367829.95)

MONEY is deprecated. You work with it as a string, not a number.

Use NUMERIC instead.

Best,  
jeremy
