123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::ConnectionAdapters::PostgreSQL::Utils

Do not use. This module is for internal use only.

Instance Method Summary

Instance Method Details

#extract_schema_qualified_name(string)

Returns an instance of Name extracted from string. schema is nil if not specified in string. schema and identifier exclude surrounding quotes (regardless of whether provided in string) string supports the range of schema/table references understood by ::ActiveRecord::ConnectionAdapters::PostgreSQL, for example:

  • table_name

  • "table.name"

  • schema_name.table_name

  • schema_name."table.name"

  • "schema_name".table_name

  • "schema.name"."table name"

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/postgresql/utils.rb', line 60

def extract_schema_qualified_name(string)
  schema, table = string.scan(/[^".]+|"[^"]*"/)
  if table.nil?
    table = schema
    schema = nil
  end
  PostgreSQL::Name.new(schema, table)
end

#unquote_identifier(identifier)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/postgresql/utils.rb', line 69

def unquote_identifier(identifier)
  if identifier && identifier.start_with?('"')
    identifier[1..-2]
  else
    identifier
  end
end