ruby-pg-extras 4.9.0 → 4.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28817e57f333673450b7717d6477212f620e7b9ff2d47e64602a575913b00e57
4
- data.tar.gz: 564ff926e6ef12499ca3f4e9572f59ebe364129ff354079f32d2c88269c83c44
3
+ metadata.gz: c4b41078ac90e9598de6184dd02b7d351cafd32456e4f398f2d7902e233f053d
4
+ data.tar.gz: a8f19f5324b1c94a8f2516cf44087afec4d58b9a93537602175d225aeccb51e7
5
5
  SHA512:
6
- metadata.gz: a604904f5d6382ccf5b6c94afcdb3f25b55f214981921d0044ca72a89bde0f12b7089ae7d3dccd1b616a25e1c20e0178eed4fd4db8c1cd6359bd2a0bef6d57db
7
- data.tar.gz: 06cabd33eaa90d5d0db7ad5fc5153433c50207d97e26800b1290bf81e704ac2ff9fe1325843200fb3ddd13b8b3383d2259c38dcb1630d274294ae93bd294db4b
6
+ metadata.gz: 48bbea030d77d6b27ff9000d3b7b7cf66a75386321559db2ba925edcc4c6dac9893ff5ce2bea54676b250a0e0e5219a9faf874b02e10d96236a249c84c2d9352
7
+ data.tar.gz: efb3cff55c6f5421813f3ac6d88cdbbd96ed08d1b8246099bf17416691ed480ae96459b2e2ce9c3dbc95eed418a85e4011097235f9407d0a9e359ec154260537
data/README.md CHANGED
@@ -635,6 +635,24 @@ RubyPgExtras.mandelbrot
635
635
 
636
636
  This command outputs the Mandelbrot set, calculated through SQL.
637
637
 
638
+ ### `connections`
639
+
640
+ ```ruby
641
+
642
+ RubyPgExtras.connections
643
+
644
+ +-----------------------------------------------------+
645
+ | Returns the list of all active database connections |
646
+ +-----------------+----------------+------------------+
647
+ | username | client_address | application_name |
648
+ +-----------------+----------------+------------------+
649
+ | postgres | 172.19.0.1/32 | psql |
650
+ | postgres | 172.19.0.1/32 | irb |
651
+ +-----------------+----------------+------------------+
652
+ ```
653
+
654
+ This command returns the list of all active database connections.
655
+
638
656
  ## Testing
639
657
 
640
658
  ```bash
@@ -24,7 +24,7 @@ module RubyPgExtras
24
24
  table_size total_index_size total_table_size
25
25
  unused_indexes duplicate_indexes vacuum_stats kill_all
26
26
  pg_stat_statements_reset buffercache_stats
27
- buffercache_usage ssl_used
27
+ buffercache_usage ssl_used connections
28
28
  )
29
29
 
30
30
  DEFAULT_ARGS = Hash.new({}).merge({
@@ -0,0 +1,4 @@
1
+ /* Returns the list of all active database connections */
2
+
3
+ SELECT usename as username, client_addr::text as client_address, application_name FROM pg_stat_activity
4
+ WHERE datname = current_database();
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyPgExtras
4
- VERSION = "4.9.0"
4
+ VERSION = "4.10.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-pg-extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.0
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-18 00:00:00.000000000 Z
11
+ date: 2022-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -96,6 +96,7 @@ files:
96
96
  - lib/ruby_pg_extras/queries/cache_hit.sql
97
97
  - lib/ruby_pg_extras/queries/calls.sql
98
98
  - lib/ruby_pg_extras/queries/calls_legacy.sql
99
+ - lib/ruby_pg_extras/queries/connections.sql
99
100
  - lib/ruby_pg_extras/queries/db_settings.sql
100
101
  - lib/ruby_pg_extras/queries/duplicate_indexes.sql
101
102
  - lib/ruby_pg_extras/queries/extensions.sql