module ActiveRecord::PGCollation::PostgreSQLAdapter
Public Instance Methods
collations()
click to toggle source
Helper method used by the monkeypatch internals. Provides an array of collations as they exist currently.
# File lib/active_record/pg_collation/postgresql_adapter.rb, line 10 def collations provider_mapping = {"i" => "icu", "c" => "libc", "d" => "libc"} result = ActiveRecord::Base.connection.exec_query(<<-SQL.strip_heredoc, "SCHEMA") SELECT c.collname AS name, c.collcollate AS lc_collate, c.collctype AS lc_ctype, c.collprovider AS provider, c.collisdeterministic AS deterministic FROM pg_collation c JOIN pg_catalog.pg_namespace n ON n.oid = c.collnamespace WHERE n.nspname = ANY (current_schemas(false)) SQL result.to_a.sort_by {|h| h["name"]}.each {|h| h["provider"] = provider_mapping[h["provider"]]} end