This project is archived and is in readonly mode.
A small modification at ActiveRecord's calculations.rb
-
Michael Koziarski
Hi There,
Can you make the change and submit a patch:
http://rails.lighthouseapp.com/p...
If you need help with using git the folks in #rails-contrib will probably be able to help.
-
Tom Ward
- Tag set to activerecord, patch, tiny
I've created a patch with Michalis' change (for which he should get the credit), and tested against sqlite3 and mysql. As this fixes a problem in a non-core adapter, I can't see how best to add a test. Any ideas?
-
Repository
- State changed from new to committed
(from [c7375d74d9fff3219d4ea389ba9e36a90afe9d33]) Alias subquery used in calculations, to provide better compatibility with databases such as MonetDB
Signed-off-by: Michael Koziarski michael@koziarski.com Signed-off-by: Tom Ward tom@popdog.net [#796 A small modification at ActiveRecord's calculations.rb state:committed] http://github.com/rails/rails/co...
-
Repository
(from [b6ad9a75ccf0e8734312357a7ac9dd7c47fd4cf1]) Alias subquery used in calculations, to provide better compatibility with databases such as MonetDB
Signed-off-by: Michael Koziarski michael@koziarski.com Signed-off-by: Tom Ward tom@popdog.net [#796 A small modification at ActiveRecord's calculations.rb state:committed] http://github.com/rails/rails/co...
-
Raimonds Simanovskis
This change in Rails 2.1.1 broke Oracle database compatibility :(
See http://rails.lighthouseapp.com/p...
At first, there is bug that instead of using single quotes in ### sql << ') AS #{aggregate_alias}subquery' if use_workaround ### you should use double quotes: ### sql << ") AS #{aggregate_alias}subquery" if use_workaround ###
And second, this "AS table_alias" syntax is not supported by Oracle database - see latest Oracle syntax specification at http://download.oracle.com/docs/...
So I think this change should be reverted and probably moved to database adapter where each adapter could specify correct way how to add table aliases in SQL queries.
-
Ed Lebert
Raimonds,
Do you have a suggested workaround for this in the mean time? My oracle rails app broke :(
-
Raimonds Simanovskis
You can apply quick monkey patch from http://rails.lighthouseapp.com/p...
I am going to include similar monkey patch in my next version of oracle_enhanced adapter.
And I will also try to get this fixed for next release of Rails. Correct solution would be to remove "AS" keyword from line http://github.com/rails/rails/tr... as "AS" keyword for table alias is not supported by Oracle and is optional for other databases (also for MonetDB which caused this problem :( )
-
Michael Koziarski
I believe this: http://github.com/rails/rails/co... should have fixed it now?
-
Raimonds Simanovskis
Yes, now it's fine for Oracle. Thanks Michael.
Just one additional comment - Oracle allows max 30 characters in any identifier (table name, index name, column name, alias name etc.). Therefore for Oracle it would be better not to generate too long identifiers from Rails (like appending to column names long suffix "_subquery"). So if you can please use short prefixes and suffixes :)
-
john
Raimonds, even though this issue is solved and the monkey patch helped I just had a question.
When the changes are made from version to version, no unit tests are performed?
-
Raimonds Simanovskis
John,
As Oracle adapter is not anymore in core ActiveRecord, then ActiveRecord unit tests are not run on Oracle database during Rails continuous integration builds. Therefore such issues might appear when some changes are made which break compatibility with other non-core databases.
I tried to run all ActiveRecord unit tests on Oracle database but currently quite a lot are failing - because of too-long identifiers, because of some Oracle specific limitations etc. Probably in the future I together with Rails core team will manage that all ActiveRecord unit tests will run on Oracle database :) But now it's not so easy to identify new changes which break compatibility.
