module ActiveRecord::Import::PostgreSQLAdapter

Constants

MIN_VERSION_FOR_UPSERT

Public Instance Methods

next_value_for_sequence(sequence_name) click to toggle source
# File lib/activerecord-import/adapters/postgresql_adapter.rb, line 24
def next_value_for_sequence(sequence_name)
  %Q{nextval('#{sequence_name}')}
end
sql_for_conflict_target( args = {} ) click to toggle source
# File lib/activerecord-import/adapters/postgresql_adapter.rb, line 108
def sql_for_conflict_target( args = {} )
  constraint_name = args[:constraint_name]
  conflict_target = args[:conflict_target]
  if constraint_name
    "ON CONSTRAINT #{constraint_name} "
  elsif conflict_target
    '(' << Array( conflict_target ).join( ', ' ) << ') '
  end
end
sql_for_default_conflict_target( table_name ) click to toggle source
# File lib/activerecord-import/adapters/postgresql_adapter.rb, line 118
def sql_for_default_conflict_target( table_name )
  "(#{primary_key( table_name )}) "
end
support_setting_primary_key_of_imported_objects?() click to toggle source
# File lib/activerecord-import/adapters/postgresql_adapter.rb, line 135
def support_setting_primary_key_of_imported_objects?
  true
end
supports_on_duplicate_key_ignore?(current_version = postgresql_version) click to toggle source
# File lib/activerecord-import/adapters/postgresql_adapter.rb, line 131
def supports_on_duplicate_key_ignore?(current_version = postgresql_version)
  supports_on_duplicate_key_update?(current_version)
end
supports_on_duplicate_key_update?(current_version = postgresql_version) click to toggle source
# File lib/activerecord-import/adapters/postgresql_adapter.rb, line 127
def supports_on_duplicate_key_update?(current_version = postgresql_version)
  current_version >= MIN_VERSION_FOR_UPSERT
end