lib/sequel/postgres/schemata.rb in sequel-postgres-schemata-0.1.0 vs lib/sequel/postgres/schemata.rb in sequel-postgres-schemata-0.1.1
- old
+ new
@@ -67,12 +67,16 @@
map{|s|s.strip.sub(SCHEMA_SUB_RE, '\1').gsub('""', '"').to_sym}
end
def run_with_search_path path, &block
old_path = search_path
- self.search_path = path
- yield
- self.search_path = old_path
+
+ begin
+ self.search_path = path
+ yield
+ ensure
+ self.search_path = old_path
+ end
end
SHOW_SEARCH_PATH = "SHOW search_path".freeze
SCHEMA_SCAN_RE = /(?<=\A|,)(".*?"|.*?)(?=,|\z)/.freeze
SCHEMA_SUB_RE = /\A"(.*)"\z/.freeze