def tsorted_views(views_names)
          views_hash = TSortableHash.new

          ::Scenic.database.execute(DEPENDENT_SQL).each do |relation|
            source_v = [
              relation["source_schema"],
              relation["source_table"]
            ].compact.join(".")

            dependent = [
              relation["dependent_schema"],
              relation["dependent_view"]
            ].compact.join(".")

            views_hash[dependent] ||= []
            views_hash[source_v] ||= []
            views_hash[dependent] << source_v

            views_names.delete(relation["source_table"])
            views_names.delete(relation["dependent_view"])
          end

          # after dependencies, there might be some views left
          # that don't have any dependencies
          views_names.sort.each { |v| views_hash[v] ||= [] }
          views_hash.tsort
        end
When dumping the views, their order must be topologically
sorted to take into account dependencies