pg 1.5.6 → 1.5.9

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.
@@ -167,7 +167,7 @@ class PG::BasicTypeMapForQueries < PG::TypeMapByClass
167
167
  end
168
168
 
169
169
  begin
170
- require "bigdecimal"
170
+ PG.require_bigdecimal_without_warning
171
171
  has_bigdecimal = true
172
172
  rescue LoadError
173
173
  end
@@ -171,7 +171,14 @@ class PG::BasicTypeRegistry
171
171
  include Checker
172
172
 
173
173
  def initialize
174
- # The key of these hashs maps to the `typname` column from the table pg_type.
174
+ # @coders_by_name has a content of
175
+ # Array< Hash< Symbol: Hash< String: Coder > > >
176
+ #
177
+ # The layers are:
178
+ # * index of Array is 0 (text) and 1 (binary)
179
+ # * Symbol key in the middle Hash is :encoder and :decoder
180
+ # * String key in the inner Hash corresponds to the `typname` column in the table pg_type
181
+ # * Coder value in the inner Hash is the associated coder object
175
182
  @coders_by_name = []
176
183
  end
177
184
 
@@ -226,7 +233,7 @@ class PG::BasicTypeRegistry
226
233
  alias_type 0, 'oid', 'int2'
227
234
 
228
235
  begin
229
- require "bigdecimal"
236
+ PG.require_bigdecimal_without_warning
230
237
  register_type 0, 'numeric', PG::TextEncoder::Numeric, PG::TextDecoder::Numeric
231
238
  rescue LoadError
232
239
  end
@@ -271,6 +278,7 @@ class PG::BasicTypeRegistry
271
278
  register_type 0, 'inet', PG::TextEncoder::Inet, PG::TextDecoder::Inet
272
279
  alias_type 0, 'cidr', 'inet'
273
280
 
281
+ register_type 0, 'record', PG::TextEncoder::Record, PG::TextDecoder::Record
274
282
 
275
283
 
276
284
  register_type 1, 'int2', PG::BinaryEncoder::Int2, PG::BinaryDecoder::Integer
data/lib/pg/connection.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'pg' unless defined?( PG )
5
- require 'io/wait' unless ::IO.public_instance_methods(false).include?(:wait_readable)
5
+ require 'io/wait' unless ::IO.public_instance_methods(false).include?(:wait_readable) # for ruby < 3.0
6
6
  require 'socket'
7
7
 
8
8
  # The PostgreSQL connection class. The interface for this class is based on
@@ -117,7 +117,7 @@ class PG::Connection
117
117
  return str
118
118
  end
119
119
 
120
- BinarySignature = "PGCOPY\n\377\r\n\0".b
120
+ BinarySignature = "PGCOPY\n\377\r\n\0"
121
121
  private_constant :BinarySignature
122
122
 
123
123
  # call-seq:
@@ -166,7 +166,10 @@ class PG::Connection
166
166
  # conn.put_copy_data ['more', 'data', 'to', 'copy']
167
167
  # end
168
168
  #
169
- # Also PG::BinaryEncoder::CopyRow can be used to send data in binary format to the server.
169
+ # All 4 CopyRow classes can take a type map to specify how the columns are mapped to and from the database format.
170
+ # For details see the particular CopyRow class description.
171
+ #
172
+ # PG::BinaryEncoder::CopyRow can be used to send data in binary format to the server.
170
173
  # In this case copy_data generates the header and trailer data automatically:
171
174
  # enco = PG::BinaryEncoder::CopyRow.new
172
175
  # conn.copy_data "COPY my_table FROM STDIN (FORMAT binary)", enco do
@@ -306,6 +309,11 @@ class PG::Connection
306
309
  rollback = false
307
310
  exec "BEGIN"
308
311
  yield(self)
312
+ rescue PG::RollbackTransaction
313
+ rollback = true
314
+ cancel if transaction_status == PG::PQTRANS_ACTIVE
315
+ block
316
+ exec "ROLLBACK"
309
317
  rescue Exception
310
318
  rollback = true
311
319
  cancel if transaction_status == PG::PQTRANS_ACTIVE
@@ -493,7 +501,7 @@ class PG::Connection
493
501
  # See also #copy_data.
494
502
  #
495
503
  def put_copy_data(buffer, encoder=nil)
496
- # sync_put_copy_data does a non-blocking attept to flush data.
504
+ # sync_put_copy_data does a non-blocking attempt to flush data.
497
505
  until res=sync_put_copy_data(buffer, encoder)
498
506
  # It didn't flush immediately and allocation of more buffering memory failed.
499
507
  # Wait for all data sent by doing a blocking flush.
@@ -565,7 +573,9 @@ class PG::Connection
565
573
  # Resets the backend connection. This method closes the
566
574
  # backend connection and tries to re-connect.
567
575
  def reset
568
- iopts = conninfo_hash.compact
576
+ # Use connection options from PG::Connection.new to reconnect with the same options but with renewed DNS resolution.
577
+ # Use conninfo_hash as a fallback when connect_start was used to create the connection object.
578
+ iopts = @iopts_for_reset || conninfo_hash.compact
569
579
  if iopts[:host] && !iopts[:host].empty? && PG.library_version >= 100000
570
580
  iopts = self.class.send(:resolve_hosts, iopts)
571
581
  end
@@ -643,8 +653,6 @@ class PG::Connection
643
653
  # Track the progress of the connection, waiting for the socket to become readable/writable before polling it
644
654
 
645
655
  if (timeo = conninfo_hash[:connect_timeout].to_i) && timeo > 0
646
- # Lowest timeout is 2 seconds - like in libpq
647
- timeo = [timeo, 2].max
648
656
  host_count = conninfo_hash[:host].to_s.count(",") + 1
649
657
  stop_time = timeo * host_count + Process.clock_gettime(Process::CLOCK_MONOTONIC)
650
658
  end
@@ -817,6 +825,7 @@ class PG::Connection
817
825
  iopts = PG::Connection.conninfo_parse(option_string).each_with_object({}){|h, o| o[h[:keyword].to_sym] = h[:val] if h[:val] }
818
826
  iopts = PG::Connection.conndefaults.each_with_object({}){|h, o| o[h[:keyword].to_sym] = h[:val] if h[:val] }.merge(iopts)
819
827
 
828
+ iopts_for_reset = iopts
820
829
  if iopts[:hostaddr]
821
830
  # hostaddr is provided -> no need to resolve hostnames
822
831
 
@@ -830,6 +839,8 @@ class PG::Connection
830
839
 
831
840
  raise PG::ConnectionBad, conn.error_message if conn.status == PG::CONNECTION_BAD
832
841
 
842
+ # save the connection options for conn.reset
843
+ conn.instance_variable_set(:@iopts_for_reset, iopts_for_reset)
833
844
  conn.send(:async_connect_or_reset, :connect_poll)
834
845
  conn
835
846
  end
data/lib/pg/exceptions.rb CHANGED
@@ -21,5 +21,11 @@ module PG
21
21
  class NotInBlockingMode < PG::Error
22
22
  end
23
23
 
24
+ # PG::Connection#transaction uses this exception to distinguish a deliberate rollback from other exceptional situations.
25
+ # Normally, raising an exception will cause the .transaction method to rollback the database transaction and pass on the exception.
26
+ # But if you raise an PG::RollbackTransaction exception, then the database transaction will be rolled back, without passing on the exception.
27
+ class RollbackTransaction < StandardError
28
+ end
29
+
24
30
  end # module PG
25
31
 
@@ -5,6 +5,9 @@ require 'date'
5
5
 
6
6
  module PG
7
7
  module TextDecoder
8
+ # This is a decoder class for conversion of PostgreSQL date type to Ruby Date values.
9
+ #
10
+ # As soon as this class is used, it requires the ruby standard library 'date'.
8
11
  class Date < SimpleDecoder
9
12
  def decode(string, tuple=nil, field=nil)
10
13
  if string =~ /\A(\d{4})-(\d\d)-(\d\d)\z/
@@ -5,6 +5,9 @@ require 'json'
5
5
 
6
6
  module PG
7
7
  module TextDecoder
8
+ # This is a decoder class for conversion of PostgreSQL JSON/JSONB type to Ruby Hash, Array, String, Numeric, nil values.
9
+ #
10
+ # As soon as this class is used, it requires the ruby standard library 'json'.
8
11
  class JSON < SimpleDecoder
9
12
  def decode(string, tuple=nil, field=nil)
10
13
  ::JSON.parse(string, quirks_mode: true)
@@ -3,6 +3,7 @@
3
3
 
4
4
  module PG
5
5
  module TextEncoder
6
+ # This is a encoder class for conversion of Ruby Date values to PostgreSQL date type.
6
7
  class Date < SimpleEncoder
7
8
  def encode(value)
8
9
  value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d") : value
@@ -5,6 +5,9 @@ require 'ipaddr'
5
5
 
6
6
  module PG
7
7
  module TextEncoder
8
+ # This is a encoder class for conversion of Ruby IPAddr values to PostgreSQL inet type.
9
+ #
10
+ # As soon as this class is used, it requires the ruby standard library 'ipaddr'.
8
11
  class Inet < SimpleEncoder
9
12
  def encode(value)
10
13
  case value
@@ -5,6 +5,9 @@ require 'json'
5
5
 
6
6
  module PG
7
7
  module TextEncoder
8
+ # This is a encoder class for conversion of Ruby Hash, Array, String, Numeric, nil values to PostgreSQL JSON/JSONB type.
9
+ #
10
+ # As soon as this class is used, it requires the ruby standard library 'json'.
8
11
  class JSON < SimpleEncoder
9
12
  def encode(value)
10
13
  ::JSON.generate(value, quirks_mode: true)
data/lib/pg/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module PG
2
2
  # Library version
3
- VERSION = '1.5.6'
3
+ VERSION = '1.5.9'
4
4
  end
data/lib/pg.rb CHANGED
@@ -126,4 +126,14 @@ module PG
126
126
  Warning.extend(TruffleFixWarn)
127
127
  end
128
128
 
129
+ # Ruby-3.4+ prints a warning, if bigdecimal is required but not in the Gemfile.
130
+ # But it's a false positive, since we enable bigdecimal depending features only if it's available.
131
+ # And most people don't need these features.
132
+ def self.require_bigdecimal_without_warning
133
+ oldverb, $VERBOSE = $VERBOSE, nil
134
+ require "bigdecimal"
135
+ ensure
136
+ $VERBOSE = oldverb
137
+ end
138
+
129
139
  end # module PG
data/pg.gemspec CHANGED
@@ -23,7 +23,9 @@ Gem::Specification.new do |spec|
23
23
  # Specify which files should be added to the gem when it is released.
24
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
25
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features|translation)/}) }
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{\A(?:test|spec|features|translation|\.)})
28
+ end
27
29
  end
28
30
  spec.extensions = ["ext/extconf.rb"]
29
31
  spec.require_paths = ["lib"]
data.tar.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- � �!�a+�)���0�K��q��@�������U&�cP�r�u�k�$i`v6�L?E�U|�)�hg��a>o2�ZC��6JP��
2
- ��y(��޲9+�nI���PzR�, ��n�M�1,)�a�꧱��!?�9wo�L�� [N�ax�:�=���2*f>~���p���&@UNuڵ�Z򗕠L�N��7�b\A��������(:��>O1�)���5!�1��͍�DPD�)����M8�/BS��4~P�~��ue/�7z��^�hZ�;0���s/�+���Ӈ�s3ڷ!%
3
- �3� ��-Uf��s����:�4$@�{Hq.��T1��ED�2$�W��)���~�S16M�U�C���}x�
1
+ ��B����PuH����/T_J)�Wvb -vDj�í�,xxJ?�0RR
2
+ ��Xr�W %��e��Y���o���+"���
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.6
4
+ version: 1.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -33,7 +33,7 @@ cert_chain:
33
33
  5wFER6XhvvLDFAMh/jMg+s7Wd5SbSHgHNSUaUGVtdWkVPOer6oF0aLdZUR3CETkn
34
34
  5nWXZma/BUd3YgYA/Xumc6QQqIS4p7mr
35
35
  -----END CERTIFICATE-----
36
- date: 2024-03-01 00:00:00.000000000 Z
36
+ date: 2024-10-24 00:00:00.000000000 Z
37
37
  dependencies: []
38
38
  description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
39
39
  9.3 and later.
@@ -100,18 +100,6 @@ extra_rdoc_files:
100
100
  - lib/pg/type_map_by_column.rb
101
101
  - lib/pg/version.rb
102
102
  files:
103
- - ".appveyor.yml"
104
- - ".gems"
105
- - ".gemtest"
106
- - ".github/workflows/binary-gems.yml"
107
- - ".github/workflows/source-gem.yml"
108
- - ".gitignore"
109
- - ".hgsigs"
110
- - ".hgtags"
111
- - ".irbrc"
112
- - ".pryrc"
113
- - ".tm_properties"
114
- - ".travis.yml"
115
103
  - BSDL
116
104
  - Contributors.rdoc
117
105
  - Gemfile
metadata.gz.sig CHANGED
Binary file
data/.appveyor.yml DELETED
@@ -1,42 +0,0 @@
1
- image: Visual Studio 2022
2
-
3
- init:
4
- - set PATH=C:/Ruby%ruby_version%/bin;c:/Program Files/Git/cmd;c:/Windows/system32;C:/Windows/System32/WindowsPowerShell/v1.0;C:/Program Files/Mercurial
5
- - set RUBYOPT=--verbose
6
- install:
7
- - ps: |
8
- if ($env:RUBYDOWNLOAD -ne $null) {
9
- $(new-object net.webclient).DownloadFile("https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-$env:RUBYDOWNLOAD.exe", "$pwd/ruby-setup.exe")
10
- cmd /c ruby-setup.exe /currentuser /verysilent /dir=C:/Ruby$env:ruby_version
11
- }
12
- - cmd: |
13
- ridk enable
14
- c:/msys64/usr/bin/bash -lc "pacman -S --noconfirm --needed ${MINGW_PACKAGE_PREFIX}-pkgconf ${MINGW_PACKAGE_PREFIX}-libyaml ${MINGW_PACKAGE_PREFIX}-gcc"
15
- - ruby --version
16
- - gem --version
17
- - gem install bundler --conservative
18
- - bundle install
19
- - ps: |
20
- if ($env:PGVERSION -ne $null)
21
- {
22
- $(new-object net.webclient).DownloadFile('http://get.enterprisedb.com/postgresql/postgresql-' + $env:PGVERSION + '.exe', 'C:/postgresql-setup.exe')
23
- cmd /c "C:/postgresql-setup.exe" --mode unattended --extract-only 1
24
-
25
- $env:PATH = 'C:/Program Files/PostgreSQL/' + $env:PGVER + '/bin;' + $env:PATH
26
- $env:PATH = 'C:/Program Files (x86)/PostgreSQL/' + $env:PGVER + '/bin;' + $env:PATH
27
- } else {
28
- c:/msys64/usr/bin/bash -lc "pacman -S --noconfirm --needed `${MINGW_PACKAGE_PREFIX}-postgresql"
29
- }
30
- - echo %PATH%
31
- - pg_config
32
- build_script:
33
- - bundle exec rake -rdevkit compile --trace
34
- test_script:
35
- - bundle exec rake test PG_DEBUG=0
36
- on_failure:
37
- - find -name mkmf.log | xargs cat
38
- environment:
39
- matrix:
40
- - ruby_version: "head"
41
- RUBYDOWNLOAD: x86
42
- - ruby_version: "30-x64"
data/.gems DELETED
@@ -1,6 +0,0 @@
1
- # .gems generated gem export file. Note that any env variable settings will be missing. Append these after using a ';' field separator
2
- rake-compiler -v1.1.0
3
- rake-compiler-dock -v1.0.0
4
- hoe-deveiate -v0.10.0
5
- hoe-bundler -v1.3.0
6
-
data/.gemtest DELETED
File without changes
@@ -1,117 +0,0 @@
1
- name: Binary gems
2
-
3
- on:
4
- push:
5
- pull_request:
6
- workflow_dispatch:
7
- schedule:
8
- - cron: "0 5 * * 3" # At 05:00 on Wednesday # https://crontab.guru/#0_5_*_*_3
9
-
10
- jobs:
11
- job_build_x64:
12
- name: Build
13
- runs-on: ubuntu-latest
14
- strategy:
15
- fail-fast: false
16
- matrix:
17
- include:
18
- - platform: "x64-mingw-ucrt"
19
- - platform: "x64-mingw32"
20
- - platform: "x86-mingw32"
21
- steps:
22
- - uses: actions/checkout@v3
23
- - name: Set up Ruby
24
- uses: ruby/setup-ruby@v1
25
- with:
26
- ruby-version: "3.3"
27
- - run: bundle install
28
-
29
- - name: Create a dummy cert to satisfy the build
30
- run: |
31
- mkdir -p ~/.gem/
32
- ruby -ropenssl -e "puts OpenSSL::PKey::RSA.new(2048).to_pem" > ~/.gem/gem-private_key.pem
33
- gem cert --build travis-ci@dummy.org --private-key ~/.gem/gem-private_key.pem
34
- cp gem-public_cert.pem ~/.gem/gem-public_cert.pem
35
-
36
- - name: Build binary gem
37
- run: bundle exec rake gem:windows:${{ matrix.platform }}
38
-
39
- - name: Upload binary gem
40
- uses: actions/upload-artifact@v3
41
- with:
42
- name: binary-gem
43
- path: pkg/*.gem
44
-
45
- job_test_binary:
46
- name: Test
47
- needs: job_build_x64
48
- strategy:
49
- fail-fast: false
50
- matrix:
51
- include:
52
- - os: windows-latest
53
- ruby: "3.3"
54
- platform: "x64-mingw-ucrt"
55
- PGVERSION: 16.0-1-windows-x64
56
- - os: windows-latest
57
- ruby: "3.1.4-1"
58
- platform: "x86-mingw32"
59
- PGVERSION: 10.20-1-windows
60
- - os: windows-latest
61
- ruby: "2.5"
62
- platform: "x64-mingw32"
63
- PGVERSION: 10.20-1-windows
64
-
65
- runs-on: ${{ matrix.os }}
66
- env:
67
- PGVERSION: ${{ matrix.PGVERSION }}
68
- steps:
69
- - uses: actions/checkout@v3
70
- - name: Set up Ruby
71
- if: matrix.platform != 'x86-mingw32'
72
- uses: ruby/setup-ruby@v1
73
- with:
74
- ruby-version: ${{ matrix.ruby }}
75
-
76
- - name: Set up 32 bit x86 Ruby
77
- if: matrix.platform == 'x86-mingw32'
78
- run: |
79
- $(new-object net.webclient).DownloadFile("https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-${{ matrix.ruby }}/rubyinstaller-${{ matrix.ruby }}-x86.exe", "$pwd/ruby-setup.exe")
80
- cmd /c ruby-setup.exe /currentuser /verysilent /dir=C:/Ruby-${{ matrix.ruby }}
81
- echo "c:/ruby-${{ matrix.ruby }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
82
-
83
- c:/ruby-${{ matrix.ruby }}/bin/ridk enable
84
- c:/msys64/usr/bin/bash -lc "pacman -S --noconfirm --needed make `${MINGW_PACKAGE_PREFIX}-pkgconf `${MINGW_PACKAGE_PREFIX}-libyaml `${MINGW_PACKAGE_PREFIX}-gcc `${MINGW_PACKAGE_PREFIX}-make"
85
- echo "C:/msys64/$env:MSYSTEM_PREFIX/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
86
-
87
- - name: Download gem from build job
88
- uses: actions/download-artifact@v3
89
- with:
90
- name: binary-gem
91
-
92
- - name: Download PostgreSQL
93
- run: |
94
- Add-Type -AssemblyName System.IO.Compression.FileSystem
95
- function Unzip {
96
- param([string]$zipfile, [string]$outpath)
97
- [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
98
- }
99
-
100
- $(new-object net.webclient).DownloadFile("http://get.enterprisedb.com/postgresql/postgresql-$env:PGVERSION-binaries.zip", "postgresql-binaries.zip")
101
- Unzip "postgresql-binaries.zip" "."
102
- echo "$pwd/pgsql/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
103
- echo "PGUSER=$env:USERNAME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
104
- echo "PGPASSWORD=" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
105
-
106
- - run: echo $env:PATH
107
- - run: gem update --system 3.3.26
108
- - run: bundle install
109
- - run: gem install --local pg-*${{ matrix.platform }}.gem --verbose
110
- - name: Run specs
111
- run: ruby -rpg -S rspec -fd spec/**/*_spec.rb
112
-
113
- - name: Print logs if job failed
114
- if: ${{ failure() && matrix.os == 'windows-latest' }}
115
- run: |
116
- ridk enable
117
- find "$(ruby -e"puts RbConfig::CONFIG[%q[libdir]]")" -name mkmf.log -print0 | xargs -0 cat
@@ -1,141 +0,0 @@
1
- name: Source gem
2
-
3
- on:
4
- push:
5
- pull_request:
6
- workflow_dispatch:
7
- schedule:
8
- - cron: "0 5 * * 3" # At 05:00 on Wednesday # https://crontab.guru/#0_5_*_*_3
9
-
10
- jobs:
11
- job_build_gem:
12
- name: Build
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v3
16
- - name: Set up Ruby
17
- uses: ruby/setup-ruby@v1
18
- with:
19
- ruby-version: "3.2"
20
-
21
- - name: Build source gem
22
- run: gem build pg.gemspec
23
-
24
- - name: Upload source gem
25
- uses: actions/upload-artifact@v3
26
- with:
27
- name: source-gem
28
- path: "*.gem"
29
-
30
- job_test_gem:
31
- name: Test
32
- needs: job_build_gem
33
- strategy:
34
- fail-fast: false
35
- matrix:
36
- include:
37
- - os: windows
38
- ruby: "head"
39
- PGVERSION: 16.0-1-windows-x64
40
- PGVER: "16"
41
- - os: windows
42
- ruby: "2.5"
43
- PGVERSION: 9.4.26-1-windows-x64
44
- PGVER: "9.4"
45
- - os: windows
46
- ruby: "mswin"
47
- PGVERSION: 16.0-1-windows-x64
48
- PGVER: "16"
49
- - os: ubuntu
50
- ruby: "head"
51
- PGVER: "16"
52
- - os: ubuntu
53
- ruby: "3.2"
54
- PGVER: "12"
55
- - os: ubuntu
56
- os_ver: "20.04"
57
- ruby: "2.5"
58
- PGVER: "9.3"
59
- - os: ubuntu
60
- ruby: "truffleruby"
61
- PGVER: "13"
62
- - os: ubuntu
63
- ruby: "truffleruby-head"
64
- PGVER: "16"
65
- - os: macos
66
- ruby: "head"
67
- PGVERSION: 16.0-1-osx
68
- PGVER: "16"
69
-
70
- runs-on: ${{ matrix.os }}-${{ matrix.os_ver || 'latest' }}
71
- env:
72
- PGVERSION: ${{ matrix.PGVERSION }}
73
- PGVER: ${{ matrix.PGVER }}
74
- MAKE: make -j2 V=1
75
-
76
- steps:
77
- - uses: actions/checkout@v3
78
- - name: Set up Ruby
79
- uses: ruby/setup-ruby@v1
80
- with:
81
- ruby-version: ${{ matrix.ruby }}
82
-
83
- - name: Download gem from build job
84
- uses: actions/download-artifact@v3
85
- with:
86
- name: source-gem
87
-
88
- - name: Install required packages Windows
89
- if: matrix.os == 'windows' && matrix.ruby != 'mswin'
90
- shell: cmd
91
- run: ridk exec sh -c "pacman --sync --needed --noconfirm ${MINGW_PACKAGE_PREFIX}-gcc"
92
-
93
- - name: Download PostgreSQL Windows
94
- if: matrix.os == 'windows'
95
- run: |
96
- Add-Type -AssemblyName System.IO.Compression.FileSystem
97
- function Unzip {
98
- param([string]$zipfile, [string]$outpath)
99
- [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
100
- }
101
-
102
- $(new-object net.webclient).DownloadFile("http://get.enterprisedb.com/postgresql/postgresql-$env:PGVERSION-binaries.zip", "postgresql-binaries.zip")
103
- Unzip "postgresql-binaries.zip" "."
104
- echo "$pwd/pgsql/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
105
- echo "PGUSER=$env:USERNAME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
106
- echo "PGPASSWORD=" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
107
-
108
- - name: Download PostgreSQL Ubuntu
109
- if: matrix.os == 'ubuntu'
110
- run: |
111
- echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main $PGVER" | sudo tee -a /etc/apt/sources.list.d/pgdg.list
112
- wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
113
- sudo apt-get -y update
114
- sudo apt-get -y --allow-downgrades install postgresql-$PGVER libpq5=$PGVER* libpq-dev=$PGVER*
115
- echo /usr/lib/postgresql/$PGVER/bin >> $GITHUB_PATH
116
-
117
- - name: Download PostgreSQL Macos
118
- if: matrix.os == 'macos'
119
- run: |
120
- wget https://get.enterprisedb.com/postgresql/postgresql-$PGVERSION-binaries.zip && \
121
- sudo mkdir -p /Library/PostgreSQL && \
122
- sudo unzip postgresql-$PGVERSION-binaries.zip -d /Library/PostgreSQL/$PGVER && \
123
- echo /Library/PostgreSQL/$PGVER/bin >> $GITHUB_PATH
124
-
125
- - run: gem update --system 3.3.26
126
- - run: bundle install
127
-
128
- - run: gem install --local *.gem --verbose
129
-
130
- - name: Run specs
131
- env:
132
- PG_DEBUG: 0
133
- run: ruby -rpg -S rspec spec/**/*_spec.rb -cfdoc
134
-
135
- - name: Print logs if job failed
136
- if: ${{ failure() && matrix.os == 'windows' }}
137
- run: ridk exec cat tmp_test_specs/*.log
138
-
139
- - name: Print logs if job failed
140
- if: ${{ failure() && matrix.os != 'windows' }}
141
- run: cat tmp_test_specs/*.log
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- *.lock
2
- *.orig
3
- *_BACKUP_*
4
- *_BASE_*
5
- *_LOCAL_*
6
- *_REMOTE_*
7
- /.test_symlink
8
- /build/
9
- /ext/Makefile
10
- /ext/mkmf.log
11
- /ext/postgresql_lib_path.rb
12
- /doc/
13
- /lib/*.bundle
14
- /lib/*.so
15
- /lib/2.?/
16
- /lib/3.?/
17
- /pkg/
18
- /tmp/
19
- /tmp_test_*/
20
- /vendor/
21
- /lib/libpq.dll
22
- /lib/pg/postgresql_lib_path.rb