diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-08-21 18:32:29 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-21 18:32:29 +0900 |
commit | 1b21d951a9efda8bc8f99cdf6328afb45335cabb (patch) | |
tree | e2e5eececd2b39a8ce051305f996ab9821037ea9 /activerecord/test | |
parent | 97d3f5472ee2bbef630eaff4e20f9dcc7839d34f (diff) | |
download | rails-1b21d951a9efda8bc8f99cdf6328afb45335cabb.tar.gz rails-1b21d951a9efda8bc8f99cdf6328afb45335cabb.tar.bz2 rails-1b21d951a9efda8bc8f99cdf6328afb45335cabb.zip |
Prevent extra `SET time zone` in `configure_connection` (#28413)
`SET time zone 'value'` is an alias for `SET timezone TO 'value'`.
https://www.postgresql.org/docs/current/static/sql-set.html
So if `variables["timezone"]` is specified, it is enough to
`SET timezone` once.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/connection_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/connection_test.rb b/activerecord/test/cases/adapters/postgresql/connection_test.rb index 24875c6678..2bb217a8b1 100644 --- a/activerecord/test/cases/adapters/postgresql/connection_test.rb +++ b/activerecord/test/cases/adapters/postgresql/connection_test.rb @@ -220,6 +220,13 @@ module ActiveRecord end end + def test_set_session_timezone + run_without_connection do |orig_connection| + ActiveRecord::Base.establish_connection(orig_connection.deep_merge(variables: { timezone: "America/New_York" })) + assert_equal "America/New_York", ActiveRecord::Base.connection.query_value("SHOW TIME ZONE") + end + end + def test_get_and_release_advisory_lock lock_id = 5295901941911233559 list_advisory_locks = <<-SQL |