SQLServer remove_column fails with "Table 
INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE does not exist"
----------------------------------------------------------------------------------------------------

                 Key: JRUBY-1977
                 URL: http://jira.codehaus.org/browse/JRUBY-1977
             Project: JRuby
          Issue Type: Bug
          Components: ActiveRecord-JDBC
    Affects Versions: JRuby 1.1RC1
         Environment: Mac OS 10.4 and Windows XP
ar-jdbc 0.7.1 (gem)
rails 2.0.1 (gem)
            Reporter: Matt Burke
         Attachments: testinfoschema.rb

I'm upgrading JRuby for an existing application, and the migrations fail when 
they try to 'remove_column'. I've created a simple script to reproduce the 
problem. To run it, you need a rails application configured to connect to a SQL 
Server database, then:
{noformat}
> jruby script/runner testinfoschema.rb
.../jruby_r5621/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:150:in
 `log': ActiveRecord::ActiveRecordError: Table 
INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE does not exist: SELECT 
CONSTRAINT_NAME FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE where 
TABLE_NAME = 'my_table' and COLUMN_NAME = 'my_column' 
(ActiveRecord::StatementInvalid)
        from 
.../jruby_r5621/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:132:in
 `execute'
        from 
.../jruby_r5621/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.7.1/lib/active_record/connection_adapters/jdbc_adapter.rb:503:in
 `select'
        from 
.../jruby_r5621/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.7.1/lib/jdbc_adapter/jdbc_mssql.rb:253:in
 `remove_check_constraints'
        from 
.../jruby_r5621/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.7.1/lib/jdbc_adapter/jdbc_mssql.rb:239:in
 `remove_column'
        from (eval):6
{noformat}

The query it tries to execute is:
{code:sql}
SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE where 
TABLE_NAME = 'my_table' and COLUMN_NAME = 'my_column'
{code}
... and it works fine when I run it manually against the DB (0 results).


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to