Skip to content

Error when performing SQL insert in cross database scenario. #1355

@chrisortman

Description

@chrisortman

I believe this is the culprit.

When you leverage the capability of SQL Server to operate across databases the lookup for identity columns is broken because schema_cache is bound to a single connection pool.

Just to illustrate with an example the following can be added to line 84 of adapter_test_sqlserver.rb

    sql = <<~SQL
    INSERT INTO #{arunit2_database}.dbo.colleges SELECT * FROM #{arunit_database}.dbo.topics
    SQL

    assert arunit_connection.send(:query_requires_identity_insert?, sql)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions