lib/sequel/postgres/schemata.rb in sequel-postgres-schemata-0.0.3 vs lib/sequel/postgres/schemata.rb in sequel-postgres-schemata-0.0.4
- old
+ new
@@ -16,11 +16,11 @@
# Returns a symbol list containing the current search path.
# Note that the search path can contain non-existent schematas.
def search_path
metadata_dataset.with_sql(SHOW_SEARCH_PATH).
single_value.scan(SCHEMA_SCAN_RE).flatten.
- map{|s|s.sub(SCHEMA_SUB_RE, '\1').gsub('""', '"').to_sym}
+ map{|s|s.strip.sub(SCHEMA_SUB_RE, '\1').gsub('""', '"').to_sym}
end
# Sets the search path. Starting with Postgres 9.2 it can contain
# non-existent schematas.
# Accepted formats include a single symbol, a single string (passed
@@ -52,10 +52,10 @@
end
private
SHOW_SEARCH_PATH = "SHOW search_path".freeze
- SCHEMA_SCAN_RE = /(?<=\A|, )(".*?"|.*?)(?=, |\z)/.freeze
+ SCHEMA_SCAN_RE = /(?<=\A|,)(".*?"|.*?)(?=,|\z)/.freeze
SCHEMA_SUB_RE = /\A"(.*)"\z/.freeze
RENAME_SCHEMA_SQL = 'ALTER SCHEMA "%s" RENAME TO "%s"'.freeze
end
end