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


#1

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.


#2

On 4/11/06, Lori O. 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.


#3

Wilson B. wrote:

On 4/11/06, Lori O. 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.


#4

Wilson B. wrote:

On 4/11/06, Lori O. 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.


#5

Lori O. wrote:

Wilson B. wrote:

On 4/11/06, Lori O. 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)


#6

On 4/11/06, Lori O. 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.


#7

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

http://dev.rubyonrails.org/ticket/4703