# Oracle unit test problem in Rails 1.1.2/Ruby-OCI 0.1.14

**URL:** <https://www.ruby-forum.com/t/oracle-unit-test-problem-in-rails-1-1-2-ruby-oci-0-1-14/57557>\
**Category:** Rails\
**Created:** [April 12, 2006, 12:29am UTC](https://www.ruby-forum.com/t/oracle-unit-test-problem-in-rails-1-1-2-ruby-oci-0-1-14/57557 "2006-04-12T00:29:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8dc957/32.png) [@lori](https://www.ruby-forum.com/u/lori)\
**Post date:** [April 12, 2006, 12:29am UTC](https://www.ruby-forum.com/t/oracle-unit-test-problem-in-rails-1-1-2-ruby-oci-0-1-14/57557/1 "2006-04-12T00:29:05Z")

</div>

I’ve upgraded to Rails 1.1.2, and I’m trying to push this change through  
to our build server (Linux/Oracle) and we are getting some errors in the  
unit tests using Oracle. Looking at the data in the tests reveals a  
precision problem. Looking at the tables tells the whole story.

My development database contains this table:

SQL\> describe dls\_grids;  
Name Null? Type

* * *

* * *

ID NOT NULL NUMBER(38)  
LSD VARCHAR2(2)  
SECTION VARCHAR2(2)  
TOWNSHIP VARCHAR2(3)  
RANGE VARCHAR2(2)  
MERIDIAN VARCHAR2(2)  
LATITUDE\_MIN NUMBER(8,5)  
LATITUDE\_MAX NUMBER(8,5)  
LONGITUDE\_MIN NUMBER(8,5)  
LONGITUDE\_MAX NUMBER(8,5)

But the table that gets created in test looks like this:

SQL\> describe dls\_grids;  
Name Null? Type

* * *

* * *

ID NOT NULL NUMBER(38)  
LSD VARCHAR2(2)  
SECTION VARCHAR2(2)  
TOWNSHIP VARCHAR2(3)  
RANGE VARCHAR2(2)  
MERIDIAN VARCHAR2(2)  
LATITUDE\_MIN NUMBER(8)  
LATITUDE\_MAX NUMBER(8)  
LONGITUDE\_MIN NUMBER(8)  
LONGITUDE\_MAX NUMBER(8)

This is a critical issue for our production application.

---

<div class="post-metadata">

**Author:** ![lori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8dc957/32.png) [@lori](https://www.ruby-forum.com/u/lori)\
**Post date:** [April 12, 2006, 1:42am UTC](https://www.ruby-forum.com/t/oracle-unit-test-problem-in-rails-1-1-2-ruby-oci-0-1-14/57557/2 "2006-04-12T01:42:21Z")

</div>

On 4/11/06, Lori O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’ve upgraded to Rails 1.1.2, and I’m trying to push this change through  
> to our build server (Linux/Oracle) and we are getting some errors in the  
> unit tests using Oracle. Looking at the data in the tests reveals a  
> precision problem. Looking at the tables tells the whole story.
> 
> My development database contains this table:

Are you using migrations to create that table, or  
db:test:clone\_structure?  
If you’re using a migration, you could use “execute” to issue the  
direct DDL statement.

---

<div class="post-metadata">

**Author:** ![lori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8dc957/32.png) [@lori](https://www.ruby-forum.com/u/lori)\
**Post date:** [April 12, 2006, 3:44am UTC](https://www.ruby-forum.com/t/oracle-unit-test-problem-in-rails-1-1-2-ruby-oci-0-1-14/57557/3 "2006-04-12T03:44:51Z")

</div>

Wilson B. wrote:

> On 4/11/06, Lori O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I’ve upgraded to Rails 1.1.2, and I’m trying to push this change through  
> > to our build server (Linux/Oracle) and we are getting some errors in the  
> > unit tests using Oracle. Looking at the data in the tests reveals a  
> > precision problem. Looking at the tables tells the whole story.
> > 
> > My development database contains this table:
> 
> Are you using migrations to create that table, or  
> db:test:clone\_structure?  
> If you’re using a migration, you could use “execute” to issue the  
> direct DDL statement.

You are misunderstanding. The Oracle DEVELOPMENT database, created by  
migrations, is working just fine. The Oracle TEST database, created  
AUTOMATICALLY by RAKE, in the process of executing a “rake test:units”  
command is BAD.

The database cloning for Oracle is _broken_.

---

<div class="post-metadata">

**Author:** ![lori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8dc957/32.png) [@lori](https://www.ruby-forum.com/u/lori)\
**Post date:** [April 12, 2006, 4:04am UTC](https://www.ruby-forum.com/t/oracle-unit-test-problem-in-rails-1-1-2-ruby-oci-0-1-14/57557/4 "2006-04-12T04:04:15Z")

</div>

Wilson B. wrote:

> On 4/11/06, Lori O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > > Are you using migrations to create that table, or
> 
> I understood that you were talking about the test database, but you’re  
> right, it does look broken. I just had a conversation on IRC that  
> revealed that the Oracle schema dumper also doesn’t handle boolean  
> (i.e. NUMBER(1)) columns properly.
> 
> Sounds like it’s time for a ticket.

Okey, dokey. I’ll see about posting an example. Thanks for confirming.

---

<div class="post-metadata">

**Author:** ![lori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8dc957/32.png) [@lori](https://www.ruby-forum.com/u/lori)\
**Post date:** [April 12, 2006, 6:25am UTC](https://www.ruby-forum.com/t/oracle-unit-test-problem-in-rails-1-1-2-ruby-oci-0-1-14/57557/5 "2006-04-12T06:25:53Z")

</div>

Lori O. wrote:

> Wilson B. wrote:
> 
> > On 4/11/06, Lori O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > 
> > > > Are you using migrations to create that table, or
> > 
> > I understood that you were talking about the test database, but you’re  
> > right, it does look broken. I just had a conversation on IRC that  
> > revealed that the Oracle schema dumper also doesn’t handle boolean  
> > (i.e. NUMBER(1)) columns properly.
> > 
> > Sounds like it’s time for a ticket.
> 
> Okey, dokey. I’ll see about posting an example. Thanks for confirming.

Ok, this is bad. It doesn’t actually work right for MySQL, either.  
This is the development database:

mysql\> describe dls\_grids;  
±--------------±-----------±-----±----±--------±---------------+  
| Field | Type | Null | Key | Default | Extra |  
±--------------±-----------±-----±----±--------±---------------+  
| id | int(11) | NO | PRI | NULL | auto\_increment |  
| lsd | varchar(2) | YES | | NULL | |  
| section | varchar(2) | YES | | NULL | |  
| township | varchar(3) | YES | | NULL | |  
| range | varchar(2) | YES | | NULL | |  
| meridian | varchar(2) | YES | | NULL | |  
| latitude\_min | float(8,5) | YES | | NULL | |  
| latitude\_max | float(8,5) | YES | | NULL | |  
| longitude\_min | float(8,5) | YES | | NULL | |  
| longitude\_max | float(8,5) | YES | | NULL | |  
±--------------±-----------±-----±----±--------±---------------+  
10 rows in set (0.03 sec)

And then this is the test database, after running a rake test:units :

mysql\> describe dls\_grids;  
±--------------±-----------±-----±----±--------±---------------+  
| Field | Type | Null | Key | Default | Extra |  
±--------------±-----------±-----±----±--------±---------------+  
| id | int(11) | NO | PRI | NULL | auto\_increment |  
| lsd | varchar(2) | YES | | NULL | |  
| section | varchar(2) | YES | | NULL | |  
| township | varchar(3) | YES | | NULL | |  
| range | varchar(2) | YES | | NULL | |  
| meridian | varchar(2) | YES | | NULL | |  
| latitude\_min | float | YES | | NULL | |  
| latitude\_max | float | YES | | NULL | |  
| longitude\_min | float | YES | | NULL | |  
| longitude\_max | float | YES | | NULL | |  
±--------------±-----------±-----±----±--------±---------------+  
10 rows in set (0.03 sec)

---

<div class="post-metadata">

**Author:** ![lori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8dc957/32.png) [@lori](https://www.ruby-forum.com/u/lori)\
**Post date:** [April 12, 2006, 4:02am UTC](https://www.ruby-forum.com/t/oracle-unit-test-problem-in-rails-1-1-2-ruby-oci-0-1-14/57557/6 "2006-04-12T04:02:33Z")

</div>

On 4/11/06, Lori O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Are you using migrations to create that table, or

I understood that you were talking about the test database, but you’re  
right, it does look broken. I just had a conversation on IRC that  
revealed that the Oracle schema dumper also doesn’t handle boolean  
(i.e. NUMBER(1)) columns properly.

Sounds like it’s time for a ticket.

---

<div class="post-metadata">

**Author:** ![lori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8dc957/32.png) [@lori](https://www.ruby-forum.com/u/lori)\
**Post date:** [April 12, 2006, 6:43am UTC](https://www.ruby-forum.com/t/oracle-unit-test-problem-in-rails-1-1-2-ruby-oci-0-1-14/57557/7 "2006-04-12T06:43:53Z")

</div>

Here is the ticket. I hope this can be quickly addressed.

[http://dev.rubyonrails.org/ticket/4703](http://dev.rubyonrails.org/ticket/4703)
