Module: ActiveRecord::ConnectionAdapters::Redshift::Utils
- Defined in:
- lib/active_record/connection_adapters/redshift_7_0/utils.rb,
lib/active_record/connection_adapters/redshift_7_1/utils.rb
Overview
:nodoc:
Class Method Summary collapse
-
.extract_schema_qualified_name(string) ⇒ Object
Returns an instance of
ActiveRecord::ConnectionAdapters::PostgreSQL::Name
extracted fromstring
.
Class Method Details
.extract_schema_qualified_name(string) ⇒ Object
Returns an instance of ActiveRecord::ConnectionAdapters::PostgreSQL::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 PostgreSQL, for example:
-
table_name
-
"table.name"
-
schema_name.table_name
-
schema_name."table.name"
-
"schema_name".table_name
-
"schema.name"."table name"
70 71 72 73 74 75 76 77 |
# File 'lib/active_record/connection_adapters/redshift_7_0/utils.rb', line 70 def extract_schema_qualified_name(string) schema, table = string.scan(/[^".\s]+|"[^"]*"/) if table.nil? table = schema schema = nil end Redshift::Name.new(schema, table) end |