Skip to content

Conversation

mgrunberg
Copy link
Contributor

@mgrunberg mgrunberg commented Jan 7, 2022

mysql, sqlite3 and postgresql have consistent behaviour regarding non-existing table columns (see this commit).

SQL server was returning an empty array.

This is a breaking change but apps can recover by adding a rescue block.
Make more sense to behave like all other adapters.

Fixes:

Failure:
ActiveRecord::ConnectionAdapters::SchemaCacheTest#test_columns_for_non_existent_table [/home/matias/.rvm/gems/ruby-2.7.4/bundler/gems/rails-5850a6592ff1/activerecord/test/cases/connection_adapters/schema_cache_test.rb:139]:
ActiveRecord::StatementInvalid expected but nothing was raised.

Failure:
ActiveRecord::ConnectionAdapters::SchemaCacheTest#test_columns_hash_for_non_existent_table [/home/matias/.rvm/gems/ruby-2.7.4/bundler/gems/rails-5850a6592ff1/activerecord/test/cases/connection_adapters/schema_cache_test.rb:149]:
ActiveRecord::StatementInvalid expected but nothing was raised.

Before (https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/runs/4674744906?check_suite_focus=true):

7739 runs, 21036 assertions, 94 failures, 60 errors, 43 skips

After (https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/runs/4735046133?check_suite_focus=true):

7743 runs, 21049 assertions, 92 failures, 60 errors, 43 skips

@mgrunberg mgrunberg force-pushed the raise-error-asking-for-non-existing-table-columns branch from 9846d37 to d65fc64 Compare January 7, 2022 03:49
mysql, sqlite3 and postgresql have consistent behaviour regarding
non-existing table columns (see [this
commit](rails/rails@e323e68)).

SQL Server was returning an empty array.

This is a breaking change but apps can recover by adding a rescue block.
Make more sense to behave like all other adapters
@mgrunberg mgrunberg force-pushed the raise-error-asking-for-non-existing-table-columns branch from d65fc64 to 230c111 Compare January 12, 2022 15:53
@aidanharan aidanharan merged commit d527384 into rails-sqlserver:main Jan 12, 2022
@mgrunberg mgrunberg deleted the raise-error-asking-for-non-existing-table-columns branch January 12, 2022 16:41
lavika pushed a commit to lavika/activerecord-sqlserver-adapter that referenced this pull request Sep 26, 2023
…lserver#988)

[Rails 7] Raise error asking for non-existing table columns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants