Sha256: 4c770f73cdabce9be174f8b20c6a8b5546547566efab0a6c6aa295ab53dc233c

Contents?: true

Size: 725 Bytes

Versions: 17

Compression:

Stored size: 725 Bytes

Contents

module ActiveRecord
  module ConnectionAdapters
    module PostgreSQL
      module DatabaseStatements
        def sql_for_insert(sql, pk, binds) # :nodoc:
          if pk.nil?
            # Extract the table from the insert sql. Yuck.
            table_ref = extract_table_ref_from_insert_sql(sql)
            pk = primary_key(table_ref) if table_ref
          end

          # CPK
          # if pk = suppress_composite_primary_key(pk)
          #  sql = "#{sql} RETURNING #{quote_column_name(pk)}"
          #end
          # NOTE pk can be false.
          if pk
            sql = "#{sql} RETURNING #{quote_column_names(pk)}"
          end

          super
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
composite_primary_keys-13.0.1 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-13.0.0 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.10 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.9 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.8 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.6 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.5 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.4 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.3 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.2 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.1 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.0 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.0.rc5 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.0.rc4 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.0.rc3 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.0.rc2 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb
composite_primary_keys-12.0.0.rc1 lib/composite_primary_keys/connection_adapters/postgresql/database_statements.rb