Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#### Fixed

- [#1334](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1334) Enable identity insert on view's base table for fixtures.
- [#1339](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1339) Fix `insert_all`/`upsert_all` for table names containing numbers.

## v8.0.6

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ def get_raw_table_name(sql)
elsif s.match?(/^\s*UPDATE\s+.*/i)
s.match(/UPDATE\s+([^\(\s]+)\s*/i)[1]
elsif s.match?(/^\s*MERGE INTO.*/i)
s.match(/^\s*MERGE\s+INTO\s+(\[?[a-z_ -]+\]?\.?\[?[a-z_ -]+\]?)\s+(AS|WITH|USING)/i)[1]
s.match(/^\s*MERGE\s+INTO\s+(\[?[a-z0-9_ -]+\]?\.?\[?[a-z0-9_ -]+\]?)\s+(AS|WITH|USING)/i)[1]
else
s.match(/FROM[\s|\(]+((\[[^\(\]]+\])|[^\(\s]+)\s*/i)[1]
end.strip
Expand Down
4 changes: 4 additions & 0 deletions test/cases/schema_test_sqlserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ class SchemaTestSQLServer < ActiveRecord::TestCase
it do
assert_equal "[with].[select notation]", connection.send(:get_raw_table_name, "MERGE INTO [with].[select notation] AS target")
end

it do
assert_equal "[with_numbers_1234]", connection.send(:get_raw_table_name, "MERGE INTO [with_numbers_1234] AS target")
end
end

describe 'CREATE VIEW statements' do
Expand Down
Loading