Git Product home page Git Product logo

Comments (7)

KDGundermann avatar KDGundermann commented on May 29, 2024

looking at database_statements.rb :

       def query_requires_identity_insert?(sql)
          if insert_sql?(sql)
            table_name = get_table_name(sql)
            id_column = identity_columns(table_name).first

get_table_name() will return the table name WITHOUT database/schema
so schema_cache will look for the table in the default schema 'dbo' where this not exist

from activerecord-sqlserver-adapter.

KDGundermann avatar KDGundermann commented on May 29, 2024

Possible fix: In database_statements.rb:query_requires_identity_insert?

change

table_name = get_table_name(sql)

to

table_name = get_raw_table_name(sql)

but then a test is failing:

Failure:
AdapterTestSQLServer::identity inserts#test_0001_return quoted table_name to #query_requires_identity_insert? when INSERT sql contains id column [/home/klaus/Projekte/activerecord-sqlserver-adapter/test/cases/adapter_test_sqlserver.rb:202]:
Expected: "funny_jokes"
  Actual: "[funny_jokes]"

Strange: the test is named return_QUOTED_table_name but is testing for the unquoted name...

from activerecord-sqlserver-adapter.

mirrorspock avatar mirrorspock commented on May 29, 2024

I have run into the exact same issue,
Inserts into a different database fail.

my current workaround is to create a table in the main database with the same name.

from activerecord-sqlserver-adapter.

grantlees avatar grantlees commented on May 29, 2024

I have also run into this issue using gem 'activerecord-sqlserver-adapter', '7.0.1.0' with ruby 3.2.1 and rails 7.0.4.2.
Is there anyone looking into a permanent fix ?
Thanks

from activerecord-sqlserver-adapter.

zortech1 avatar zortech1 commented on May 29, 2024

I just ran into this on activerecord-sqlserver-adapter 7.0.1.0

from activerecord-sqlserver-adapter.

grantlees avatar grantlees commented on May 29, 2024

I patched as suggested by KDGundermann, Im quite surprised this has been sitting around for so long.

from activerecord-sqlserver-adapter.

aidanharan avatar aidanharan commented on May 29, 2024

Issue has been fixed in release v7.0.2.0

from activerecord-sqlserver-adapter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.