Skip to content
This repository
Browse code

Added encoding and min_messages options for PostgreSQL #1205 [shugo]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1255 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 9ede45f60fd112c313840e707e1fdfebb5f6b97c 1 parent 90b08c5
David Heinemeier Hansson dhh authored
11 activerecord/CHANGELOG
... ... @@ -1,5 +1,16 @@
1 1 *SVN*
2 2
  3 +* Added encoding and min_messages options for PostgreSQL #1205 [shugo]. Configuration example:
  4 +
  5 + development:
  6 + adapter: postgresql
  7 + database: rails_development
  8 + host: localhost
  9 + username: postgres
  10 + password:
  11 + encoding: UTF8
  12 + min_messages: ERROR
  13 +
3 14 * Fixed acts_as_list where deleting an item that was removed from the list would ruin the positioning of other list items #1197 [Jamis Buck]
4 15
5 16 * Added validates_exclusion_of as a negative of validates_inclusion_of
6 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -25,6 +25,8 @@ def self.postgresql_connection(config) # :nodoc:
25 25 password = config[:password].to_s
26 26
27 27 schema_order = config[:schema_order]
  28 + encoding = config[:encoding]
  29 + min_messages = config[:min_messages]
28 30
29 31 if config.has_key?(:database)
30 32 database = config[:database]
@@ -37,6 +39,8 @@ def self.postgresql_connection(config) # :nodoc:
37 39 )
38 40
39 41 pga.execute("SET search_path TO #{schema_order}") if schema_order
  42 + pga.execute("SET client_encoding TO '#{encoding}'") if encoding
  43 + pga.execute("SET client_min_messages TO '#{min_messages}'") if min_messages
40 44
41 45 pga
42 46 end
@@ -54,6 +58,8 @@ module ConnectionAdapters
54 58 # * <tt>:password</tt> -- Defaults to nothing
55 59 # * <tt>:database</tt> -- The name of the database. No default, must be provided.
56 60 # * <tt>:schema_order</tt> -- An optional schema order string that is using in a SET search_path TO <schema_order> call on connection.
  61 + # * <tt>:encoding</tt> -- An optional client encoding that is using in a SET client_encoding TO <encoding> call on connection.
  62 + # * <tt>:min_messages</tt> -- An optional client min messages that is using in a SET client_min_messages TO <min_messages> call on connection.
57 63 class PostgreSQLAdapter < AbstractAdapter
58 64 def select_all(sql, name = nil)
59 65 select(sql, name)

0 comments on commit 9ede45f

Please sign in to comment.
Something went wrong with that request. Please try again.