On 17 Apr 2008, at 08:41, Frederick Cheung wrote:

>
>
>
> On Apr 17, 8:24 am, "Michael Koziarski" <[EMAIL PROTECTED]> wrote:
>>>  Well the ones for which the adapters come with rails (mysql,  
>>> postgres,
>>>  sqlite3, sqlite (does anyone actually use sqlite non-3? there's
>>>  currently failing tests there)) should certainly all be kept  
>>> happy. I
>>>  personally don't have the faintest clue how heavily used/ 
>>> important the
>>>  others are.
>>
>> The other databases should be kept green by the maintainers of their
>> adapters.   So sqlite, mysql and postgresql are the ones we're  
>> looking
>> after.   The sqlite2 test failures are strange, is there anyone out
>> there using it at present?  Would be good to fix this before 2.1 or  
>> at
>> least document the missing functionality.
>> =
> I haven;t looked into it in any detail, but it's all stuff that is
> currently broken in  trunk. I'll try and take a closer look soon.

In 2.0.2 quote_table_name was a no-op for the sqlite adapter (if not  
overriden, which sqlite doesn't, it used to just return its argument,  
but now by default it's just the same as quote_column_name). In  
particular this messes with some of the eager loading stuff. for  
example on sqlite 3,  running

SELECT DISTINCT "developers".id FROM "developers"  LEFT OUTER JOIN  
"developers_projects" ON "developers_projects".developer_id =  
"developers".id  LEFT OUTER JOIN "projects" ON "projects".id =  
"developers_projects".project_id     WHERE (projects.id = 2)  LIMIT 1

returns the selected column as id whereas with sqlite2 it returns it  
as "developers".id which leads to much confusion In the sqlite adapter  
there's a key.sub(/^\w+\./, ''), but of course that doesn't catch it  
now that the key is "developers.id" instead of developers.id. changing  
the regex to /^"?\w+"?\./ fixes most of the failures, leaving me with

   1) Error:
test_should_count_manual_select_with_include(CalculationsTest):
ActiveRecord::StatementInvalid: SQLite::Exceptions::SQLException: near  
"DISTINCT": syntax error: SELECT COUNT(*) AS  
count_distinct_accounts_id FROM (SELECT DISTINCT DISTINCT accounts.id  
FROM "accounts"  LEFT OUTER JOIN "companies" ON "companies".id =  
"accounts".firm_id AND "companies"."type" = 'Firm'     )
     ./test/cases/../../lib/active_record/connection_adapters/ 
abstract_adapter.rb:151:in `log'
     ./test/cases/../../lib/active_record/connection_adapters/ 
sqlite_adapter.rb:132:in `execute_without_counting'
     ./test/cases/../../lib/active_record/connection_adapters/ 
sqlite_adapter.rb:353:in `catch_schema_changes'
     ./test/cases/../../lib/active_record/connection_adapters/ 
sqlite_adapter.rb:132:in `execute_without_counting'
     ./test/cases/helper.rb:38:in `execute'
     ./test/cases/../../lib/active_record/connection_adapters/ 
sqlite_adapter.rb:256:in `select'
     ./test/cases/../../lib/active_record/connection_adapters/abstract/ 
database_statements.rb:7:in `select_all_without_query_cache'
     ./test/cases/../../lib/active_record/connection_adapters/abstract/ 
query_cache.rb:55:in `select_all'
     ./test/cases/../../lib/active_record/connection_adapters/abstract/ 
database_statements.rb:13:in `select_one'
     ./test/cases/../../lib/active_record/connection_adapters/abstract/ 
database_statements.rb:19:in `select_value'
     ./test/cases/../../lib/active_record/calculations.rb:213:in  
`execute_simple_calculation'
     ./test/cases/../../lib/active_record/calculations.rb:124:in  
`calculate'
     ./test/cases/../../lib/active_record/calculations.rb:120:in  
`calculate'
     ./test/cases/../../lib/active_record/calculations.rb:46:in `count'
     ./test/cases/calculations_test.rb:249:in  
`test_should_count_manual_select_with_include'
     ./test/cases/../../lib/../../activesupport/lib/active_support/ 
testing/setup_and_teardown.rb:59:in `run'

   2) Failure:
test_add_index(MigrationTest)
     [./test/cases/migration_test.rb:82:in `test_add_index'
      ./test/cases/../../lib/../../activesupport/lib/active_support/ 
testing/setup_and_teardown.rb:59:in `run']:
Exception raised:
Class: <ActiveRecord::StatementInvalid>
Message: <"SQLite::Exceptions::SQLException: indexed columns are not  
unique: CREATE UNIQUE INDEX \"key_idx\" ON \"people\" (\"key\")">
---Backtrace---
./test/cases/../../lib/active_record/connection_adapters/ 
abstract_adapter.rb:151:in `log'
./test/cases/../../lib/active_record/connection_adapters/ 
sqlite_adapter.rb:132:in `execute_without_counting'
./test/cases/../../lib/active_record/connection_adapters/ 
sqlite_adapter.rb:353:in `catch_schema_changes'
./test/cases/../../lib/active_record/connection_adapters/ 
sqlite_adapter.rb:132:in `execute_without_counting'
./test/cases/helper.rb:38:in `execute'
./test/cases/../../lib/active_record/connection_adapters/abstract/ 
schema_statements.rb:197:in `add_index'
./test/cases/migration_test.rb:82:in `test_add_index'
./test/cases/migration_test.rb:82:in `test_add_index'
./test/cases/../../lib/../../activesupport/lib/active_support/testing/ 
setup_and_teardown.rb:59:in `run'

of those only the first one looks like http://dev.rubyonrails.org/ticket/11502 
: the fix applied also needs to be applied to the sqlite workaround.  
I'll bung all this in a patch (patches ?) if people are interested.

Fred

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to