pg_conn 0.17.2 → 0.17.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebc1f6ad069daaf41d1bc7d58d40b3215bb53e03ad43de79251361f64ada5bd2
4
- data.tar.gz: f746cf3be418cd9f5bf712e9ea2e2c549561f98ddb6741f5321464d6b71fb5e3
3
+ metadata.gz: ef63ee68c793ec597f74abe4f85815b489199f5f71db4e92f583e3a7789b58ef
4
+ data.tar.gz: 073d54f4b5000882ce86b6b09ae92b4fa8d2230015198ad07f54d0b6ed465c03
5
5
  SHA512:
6
- metadata.gz: 347112883473ba9ea49e4b041686b76f6c7c754fb5c438b39d3a7d1ffe1c8c5dbf131653f385700cfdba6023fe25c1090b301fcf701c737cbc586dc80ab74bad
7
- data.tar.gz: b297c042cf2623f419b9a1aa777c103458b71591f92a8d6461be7a5fddf0c55a176bda3cdcf58fff6cc4d77858e5cdd581836d95c8d9bf7171eb044306006e91
6
+ metadata.gz: 52d717e25fbbe755c2bceaa77c1da02bfbe82dabc30f0ce22673f1791b9fbfe50cc0f6539221c766db526d42f224baeb1da22f29cba861ada5ea8334413b2899
7
+ data.tar.gz: 54fe0f036e61099b2fd5807da67e1528930ce79386a91f570eb11ba9d6eac5d5c63a89e4c2702b5304a9680cecf904577860ef9fa251a4485d344fea31b61cdd
@@ -84,16 +84,16 @@ module PgConn
84
84
 
85
85
  # Return true if session triggers are enabled. Triggers are enabled by
86
86
  # default by Postgres
87
- def triggers?() conn.value "select current_setting('session_replication_role') = 'replica'" end
87
+ def triggers?() conn.value "select current_setting('session_replication_role') <> 'replica'" end
88
88
 
89
89
  # Enable session triggers
90
90
  def enable_triggers()
91
- conn.execute "set session session_replication_role = replica"
91
+ conn.execute "set session session_replication_role = DEFAULT"
92
92
  end
93
93
 
94
94
  # Disable session triggers
95
95
  def disable_triggers()
96
- conn.execute "set session session_replication_role = DEFAULT"
96
+ conn.execute "set session session_replication_role = replica"
97
97
  end
98
98
 
99
99
  # Execute block with session triggers on or off
@@ -107,10 +107,9 @@ module PgConn
107
107
  end
108
108
  yield
109
109
  ensure
110
- if on_off && !active
111
- disable_triggers
112
- elsif !on_off && active
113
- enable_triggers
110
+ case active
111
+ when true; enable_triggers if !triggers?
112
+ when false; disable_triggers if triggers?
114
113
  end
115
114
  end
116
115
  end
@@ -1,3 +1,3 @@
1
1
  module PgConn
2
- VERSION = "0.17.2"
2
+ VERSION = "0.17.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_conn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.2
4
+ version: 0.17.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-09 00:00:00.000000000 Z
11
+ date: 2024-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg