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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D6ae681606a23d4d66fc4ab50a15137f?d=identicon&s=25 Lori Olson (lori)
on 2006-04-12 00:29
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.
25e11a00a89683f7e01e425a1a6e305c?d=identicon&s=25 Wilson Bilkovich (Guest)
on 2006-04-12 01:42
(Received via mailing list)
On 4/11/06, Lori Olson <loriolson@labradortechnologies.com> 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.
D6ae681606a23d4d66fc4ab50a15137f?d=identicon&s=25 Lori Olson (lori)
on 2006-04-12 03:44
Wilson Bilkovich wrote:
> On 4/11/06, Lori Olson <loriolson@labradortechnologies.com> 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*.
25e11a00a89683f7e01e425a1a6e305c?d=identicon&s=25 Wilson Bilkovich (Guest)
on 2006-04-12 04:02
(Received via mailing list)
On 4/11/06, Lori Olson <loriolson@labradortechnologies.com> 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.
D6ae681606a23d4d66fc4ab50a15137f?d=identicon&s=25 Lori Olson (lori)
on 2006-04-12 04:04
Wilson Bilkovich wrote:
> On 4/11/06, Lori Olson <loriolson@labradortechnologies.com> 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.
D6ae681606a23d4d66fc4ab50a15137f?d=identicon&s=25 Lori Olson (lori)
on 2006-04-12 06:25
Lori Olson wrote:
> Wilson Bilkovich wrote:
>> On 4/11/06, Lori Olson <loriolson@labradortechnologies.com> 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)
D6ae681606a23d4d66fc4ab50a15137f?d=identicon&s=25 Lori Olson (lori)
on 2006-04-12 06:43
Here is the ticket.  I hope this can be quickly addressed.

http://dev.rubyonrails.org/ticket/4703
This topic is locked and can not be replied to.