ibmdb / ruby-ibmdb

Rails Adapter/Ruby driver for IBM DB2 and IBM Informix
42 stars 48 forks source link

using ibm_db2 along with postgres is causing a problem with 'create savepoints' #173

Open Naren1997 opened 1 month ago

Naren1997 commented 1 month ago

Hello Team,

We have two DB connections in our project, one is for storing data in our Postgres DB, another connection is for IBM DB2, which has the actual data in it, we get the data from DB2 and puts in our Postgres DB. With Postgres adaptor connection, when we have the code that calls the 'create_savepoint' method, instead of calling the code for Postgres adaptor its going to IBM DB adaptor's, I'm getting error undefined method puts_log for Postgres adaptor. It looks the issue is with https://github.com/ibmdb/ruby-ibmdb/blob/master/IBM_DB_Adapter/ibm_db/lib/active_record/connection_adapters/ibm_db_adapter.rb#L502 code such that it'll override the actual https://github.com/rails/rails/blob/main/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb#L6

environment usage ruby 3.1.2 rails 7.0.8 postgres14.3 pg gem version 1.5.5 ibm_db gem version 5.4.1

database.yml default: &default primary: adapter: postgresql schema_search_path: 'blueid' db2_source: database_tasks: false adapter: ibm_db schema: blueid encoding: utf8

Naren1997 commented 1 month ago

the db2 package has this same pattern as rails have, thus ending up overloading the rails one (though db2 connection is not used)

module ActiveRecord
 module ConnectionAdapters
  module Savepoints
   def create_savepoint(name = current_savepoint_name)
   end
  end
 end
end