pg 1.4.1 → 1.5.6

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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.appveyor.yml +15 -9
  4. data/.github/workflows/binary-gems.yml +45 -14
  5. data/.github/workflows/source-gem.yml +35 -23
  6. data/.gitignore +11 -2
  7. data/.travis.yml +2 -2
  8. data/Gemfile +3 -0
  9. data/{History.rdoc → History.md} +285 -140
  10. data/README.ja.md +300 -0
  11. data/README.md +286 -0
  12. data/Rakefile +18 -6
  13. data/Rakefile.cross +8 -11
  14. data/certs/kanis@comcard.de.pem +20 -0
  15. data/certs/larskanis-2023.pem +24 -0
  16. data/certs/larskanis-2024.pem +24 -0
  17. data/ext/errorcodes.def +4 -0
  18. data/ext/errorcodes.txt +2 -1
  19. data/ext/extconf.rb +4 -0
  20. data/ext/pg.c +15 -55
  21. data/ext/pg.h +11 -6
  22. data/ext/pg_binary_decoder.c +80 -1
  23. data/ext/pg_binary_encoder.c +225 -1
  24. data/ext/pg_coder.c +17 -8
  25. data/ext/pg_connection.c +201 -73
  26. data/ext/pg_copy_coder.c +307 -18
  27. data/ext/pg_errors.c +1 -1
  28. data/ext/pg_record_coder.c +6 -5
  29. data/ext/pg_result.c +102 -26
  30. data/ext/pg_text_decoder.c +28 -10
  31. data/ext/pg_text_encoder.c +23 -10
  32. data/ext/pg_tuple.c +35 -32
  33. data/ext/pg_type_map.c +4 -3
  34. data/ext/pg_type_map_all_strings.c +3 -3
  35. data/ext/pg_type_map_by_class.c +6 -4
  36. data/ext/pg_type_map_by_column.c +9 -5
  37. data/ext/pg_type_map_by_mri_type.c +1 -1
  38. data/ext/pg_type_map_by_oid.c +8 -5
  39. data/ext/pg_type_map_in_ruby.c +6 -3
  40. data/lib/pg/basic_type_map_based_on_result.rb +21 -1
  41. data/lib/pg/basic_type_map_for_queries.rb +19 -10
  42. data/lib/pg/basic_type_map_for_results.rb +26 -3
  43. data/lib/pg/basic_type_registry.rb +35 -33
  44. data/lib/pg/binary_decoder/date.rb +9 -0
  45. data/lib/pg/binary_decoder/timestamp.rb +26 -0
  46. data/lib/pg/binary_encoder/timestamp.rb +20 -0
  47. data/lib/pg/coder.rb +15 -13
  48. data/lib/pg/connection.rb +186 -104
  49. data/lib/pg/exceptions.rb +7 -0
  50. data/lib/pg/text_decoder/date.rb +18 -0
  51. data/lib/pg/text_decoder/inet.rb +9 -0
  52. data/lib/pg/text_decoder/json.rb +14 -0
  53. data/lib/pg/text_decoder/numeric.rb +9 -0
  54. data/lib/pg/text_decoder/timestamp.rb +30 -0
  55. data/lib/pg/text_encoder/date.rb +12 -0
  56. data/lib/pg/text_encoder/inet.rb +28 -0
  57. data/lib/pg/text_encoder/json.rb +14 -0
  58. data/lib/pg/text_encoder/numeric.rb +9 -0
  59. data/lib/pg/text_encoder/timestamp.rb +24 -0
  60. data/lib/pg/version.rb +1 -1
  61. data/lib/pg.rb +55 -15
  62. data/pg.gemspec +5 -3
  63. data/rakelib/task_extension.rb +1 -1
  64. data.tar.gz.sig +0 -0
  65. metadata +96 -32
  66. metadata.gz.sig +0 -0
  67. data/README.ja.rdoc +0 -13
  68. data/README.rdoc +0 -214
  69. data/lib/pg/binary_decoder.rb +0 -23
  70. data/lib/pg/constants.rb +0 -12
  71. data/lib/pg/text_decoder.rb +0 -46
  72. data/lib/pg/text_encoder.rb +0 -59
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5aece061d9d89ecf67827b8bdd6db7ea023df6ef00cca23555d9ee8b0e0102d
4
- data.tar.gz: de1b7e0bcdae378c3ccebb1513945f67e95c5f0a36cf7e809cdd30aeeb6c6316
3
+ metadata.gz: dabf91eb5c0f0871f693465f33fdd345e7b5fca07ffe35a0dad65f3b851d5292
4
+ data.tar.gz: ecfb93d8f10e6835b5c7b134d2861161faa9c13ecbd0fe7e5c2cc0d5257faf2b
5
5
  SHA512:
6
- metadata.gz: b86daa15aa2ad933127de6876b47d6c68bc0be82014a8c6912c0b95c7dd801be53f1ddab69d1488a12e059323eddb83dd6d40ea74fde19ccbd68fe9830cca130
7
- data.tar.gz: b2fd717ed50bf0886e5daf37eef5e689b8f6170906ab1d8b372f430285c61d03f47a11da783d9ba18592ae8de0f70bc22ec97a274f6b2cf9dde15b7aaceb8727
6
+ metadata.gz: cbba19b5af6b7eeae29313fe028579c1f1c3005a4ae0244bafa7e2562279986cbbc851a089286bd40302bc8eb46b865e0b0baa7d80ee7b8797e50f12dd4f9633
7
+ data.tar.gz: 7e4a0c5fba7fb69a25297300c92f2a96599798390b77fb26c46056bb1557682c58f905006aacdf754a83880f2e01218b04ff32473be76eeb178161098a04ab39
checksums.yaml.gz.sig CHANGED
Binary file
data/.appveyor.yml CHANGED
@@ -1,4 +1,4 @@
1
- image: Visual Studio 2019
1
+ image: Visual Studio 2022
2
2
 
3
3
  init:
4
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
@@ -7,8 +7,11 @@ install:
7
7
  - ps: |
8
8
  if ($env:RUBYDOWNLOAD -ne $null) {
9
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 /verysilent /dir=C:/Ruby$env:ruby_version
10
+ cmd /c ruby-setup.exe /currentuser /verysilent /dir=C:/Ruby$env:ruby_version
11
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"
12
15
  - ruby --version
13
16
  - gem --version
14
17
  - gem install bundler --conservative
@@ -18,19 +21,22 @@ install:
18
21
  {
19
22
  $(new-object net.webclient).DownloadFile('http://get.enterprisedb.com/postgresql/postgresql-' + $env:PGVERSION + '.exe', 'C:/postgresql-setup.exe')
20
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"
21
29
  }
22
- $env:PATH = 'C:/Program Files/PostgreSQL/' + $env:PGVER + '/bin;' + $env:PATH
23
- $env:PATH = 'C:/Program Files (x86)/PostgreSQL/' + $env:PGVER + '/bin;' + $env:PATH
30
+ - echo %PATH%
31
+ - pg_config
24
32
  build_script:
25
33
  - bundle exec rake -rdevkit compile --trace
26
34
  test_script:
27
35
  - bundle exec rake test PG_DEBUG=0
36
+ on_failure:
37
+ - find -name mkmf.log | xargs cat
28
38
  environment:
29
39
  matrix:
30
40
  - ruby_version: "head"
31
41
  RUBYDOWNLOAD: x86
32
- PGVERSION: 10.20-1-windows
33
- PGVER: 10
34
- - ruby_version: "25"
35
- PGVERSION: 9.3.25-1-windows
36
- PGVER: 9.3
42
+ - ruby_version: "30-x64"
@@ -1,10 +1,15 @@
1
1
  name: Binary gems
2
2
 
3
- on: [push, pull_request]
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
4
9
 
5
10
  jobs:
6
11
  job_build_x64:
7
- name: build
12
+ name: Build
8
13
  runs-on: ubuntu-latest
9
14
  strategy:
10
15
  fail-fast: false
@@ -12,12 +17,13 @@ jobs:
12
17
  include:
13
18
  - platform: "x64-mingw-ucrt"
14
19
  - platform: "x64-mingw32"
20
+ - platform: "x86-mingw32"
15
21
  steps:
16
- - uses: actions/checkout@v2
22
+ - uses: actions/checkout@v3
17
23
  - name: Set up Ruby
18
24
  uses: ruby/setup-ruby@v1
19
25
  with:
20
- ruby-version: "3.1"
26
+ ruby-version: "3.3"
21
27
  - run: bundle install
22
28
 
23
29
  - name: Create a dummy cert to satisfy the build
@@ -31,37 +37,55 @@ jobs:
31
37
  run: bundle exec rake gem:windows:${{ matrix.platform }}
32
38
 
33
39
  - name: Upload binary gem
34
- uses: actions/upload-artifact@v2
40
+ uses: actions/upload-artifact@v3
35
41
  with:
36
42
  name: binary-gem
37
43
  path: pkg/*.gem
38
44
 
39
45
  job_test_binary:
40
- name: Test on Windows
46
+ name: Test
41
47
  needs: job_build_x64
42
48
  strategy:
43
49
  fail-fast: false
44
50
  matrix:
45
51
  include:
46
- - ruby: "3.1"
52
+ - os: windows-latest
53
+ ruby: "3.3"
47
54
  platform: "x64-mingw-ucrt"
48
- PGVERSION: 14.2-1-windows-x64
49
- - ruby: "2.5"
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"
50
62
  platform: "x64-mingw32"
51
63
  PGVERSION: 10.20-1-windows
52
64
 
53
- runs-on: windows-latest
65
+ runs-on: ${{ matrix.os }}
54
66
  env:
55
67
  PGVERSION: ${{ matrix.PGVERSION }}
56
68
  steps:
57
- - uses: actions/checkout@v2
69
+ - uses: actions/checkout@v3
58
70
  - name: Set up Ruby
71
+ if: matrix.platform != 'x86-mingw32'
59
72
  uses: ruby/setup-ruby@v1
60
73
  with:
61
74
  ruby-version: ${{ matrix.ruby }}
62
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
+
63
87
  - name: Download gem from build job
64
- uses: actions/download-artifact@v2
88
+ uses: actions/download-artifact@v3
65
89
  with:
66
90
  name: binary-gem
67
91
 
@@ -79,8 +103,15 @@ jobs:
79
103
  echo "PGUSER=$env:USERNAME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
80
104
  echo "PGPASSWORD=" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
81
105
 
82
- - run: gem update --system
106
+ - run: echo $env:PATH
107
+ - run: gem update --system 3.3.26
83
108
  - run: bundle install
84
109
  - run: gem install --local pg-*${{ matrix.platform }}.gem --verbose
85
110
  - name: Run specs
86
- run: ruby -rpg -S rspec spec/**/*_spec.rb
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,29 +1,34 @@
1
1
  name: Source gem
2
2
 
3
- on: [push, pull_request]
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
4
9
 
5
10
  jobs:
6
11
  job_build_gem:
7
- name: build
12
+ name: Build
8
13
  runs-on: ubuntu-latest
9
14
  steps:
10
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v3
11
16
  - name: Set up Ruby
12
17
  uses: ruby/setup-ruby@v1
13
18
  with:
14
- ruby-version: "3.1"
19
+ ruby-version: "3.2"
15
20
 
16
21
  - name: Build source gem
17
22
  run: gem build pg.gemspec
18
23
 
19
24
  - name: Upload source gem
20
- uses: actions/upload-artifact@v2
25
+ uses: actions/upload-artifact@v3
21
26
  with:
22
27
  name: source-gem
23
28
  path: "*.gem"
24
29
 
25
30
  job_test_gem:
26
- name: Test built gem
31
+ name: Test
27
32
  needs: job_build_gem
28
33
  strategy:
29
34
  fail-fast: false
@@ -31,19 +36,24 @@ jobs:
31
36
  include:
32
37
  - os: windows
33
38
  ruby: "head"
34
- PGVERSION: 14.2-1-windows-x64
35
- PGVER: "14"
39
+ PGVERSION: 16.0-1-windows-x64
40
+ PGVER: "16"
36
41
  - os: windows
37
42
  ruby: "2.5"
38
43
  PGVERSION: 9.4.26-1-windows-x64
39
44
  PGVER: "9.4"
45
+ - os: windows
46
+ ruby: "mswin"
47
+ PGVERSION: 16.0-1-windows-x64
48
+ PGVER: "16"
40
49
  - os: ubuntu
41
50
  ruby: "head"
42
- PGVER: "14"
51
+ PGVER: "16"
43
52
  - os: ubuntu
44
- ruby: "3.1"
53
+ ruby: "3.2"
45
54
  PGVER: "12"
46
55
  - os: ubuntu
56
+ os_ver: "20.04"
47
57
  ruby: "2.5"
48
58
  PGVER: "9.3"
49
59
  - os: ubuntu
@@ -51,31 +61,32 @@ jobs:
51
61
  PGVER: "13"
52
62
  - os: ubuntu
53
63
  ruby: "truffleruby-head"
54
- PGVER: "14"
64
+ PGVER: "16"
55
65
  - os: macos
56
66
  ruby: "head"
57
- PGVERSION: 14.2-1-osx
58
- PGVER: "14"
67
+ PGVERSION: 16.0-1-osx
68
+ PGVER: "16"
59
69
 
60
- runs-on: ${{ matrix.os }}-latest
70
+ runs-on: ${{ matrix.os }}-${{ matrix.os_ver || 'latest' }}
61
71
  env:
62
72
  PGVERSION: ${{ matrix.PGVERSION }}
63
73
  PGVER: ${{ matrix.PGVER }}
74
+ MAKE: make -j2 V=1
64
75
 
65
76
  steps:
66
- - uses: actions/checkout@v2
77
+ - uses: actions/checkout@v3
67
78
  - name: Set up Ruby
68
79
  uses: ruby/setup-ruby@v1
69
80
  with:
70
81
  ruby-version: ${{ matrix.ruby }}
71
82
 
72
83
  - name: Download gem from build job
73
- uses: actions/download-artifact@v2
84
+ uses: actions/download-artifact@v3
74
85
  with:
75
86
  name: source-gem
76
87
 
77
88
  - name: Install required packages Windows
78
- if: matrix.os == 'windows'
89
+ if: matrix.os == 'windows' && matrix.ruby != 'mswin'
79
90
  shell: cmd
80
91
  run: ridk exec sh -c "pacman --sync --needed --noconfirm ${MINGW_PACKAGE_PREFIX}-gcc"
81
92
 
@@ -97,20 +108,21 @@ jobs:
97
108
  - name: Download PostgreSQL Ubuntu
98
109
  if: matrix.os == 'ubuntu'
99
110
  run: |
100
- echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main $PGVER" | sudo tee -a /etc/apt/sources.list.d/pgdg.list
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
101
112
  wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
102
- sudo apt -y update
103
- sudo apt -y --allow-downgrades install postgresql-$PGVER libpq5=$PGVER* libpq-dev=$PGVER*
113
+ sudo apt-get -y update
114
+ sudo apt-get -y --allow-downgrades install postgresql-$PGVER libpq5=$PGVER* libpq-dev=$PGVER*
104
115
  echo /usr/lib/postgresql/$PGVER/bin >> $GITHUB_PATH
105
116
 
106
117
  - name: Download PostgreSQL Macos
107
118
  if: matrix.os == 'macos'
108
119
  run: |
109
120
  wget https://get.enterprisedb.com/postgresql/postgresql-$PGVERSION-binaries.zip && \
110
- unzip postgresql-$PGVERSION-binaries.zip && \
111
- echo `pwd`/pgsql/bin >> $GITHUB_PATH
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
112
124
 
113
- - run: gem update --system
125
+ - run: gem update --system 3.3.26
114
126
  - run: bundle install
115
127
 
116
128
  - run: gem install --local *.gem --verbose
data/.gitignore CHANGED
@@ -1,13 +1,22 @@
1
1
  *.lock
2
+ *.orig
3
+ *_BACKUP_*
4
+ *_BASE_*
5
+ *_LOCAL_*
6
+ *_REMOTE_*
2
7
  /.test_symlink
3
8
  /build/
9
+ /ext/Makefile
10
+ /ext/mkmf.log
11
+ /ext/postgresql_lib_path.rb
4
12
  /doc/
5
13
  /lib/*.bundle
6
14
  /lib/*.so
7
- /lib/2.*/
15
+ /lib/2.?/
16
+ /lib/3.?/
8
17
  /pkg/
9
18
  /tmp/
10
- /tmp_test_specs/
19
+ /tmp_test_*/
11
20
  /vendor/
12
21
  /lib/libpq.dll
13
22
  /lib/pg/postgresql_lib_path.rb
data/.travis.yml CHANGED
@@ -38,8 +38,8 @@ before_install:
38
38
  # Download and install postgresql version to test against in /opt (for non-cross compile only)
39
39
  - echo "deb http://apt.postgresql.org/pub/repos/apt/ ${TRAVIS_DIST}-pgdg main $PGVERSION" | sudo tee -a /etc/apt/sources.list.d/pgdg.list
40
40
  - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
41
- - sudo apt -y update
42
- - sudo apt -y --allow-downgrades install postgresql-$PGVERSION libpq5=$PGVERSION* libpq-dev=$PGVERSION*
41
+ - sudo apt-get -y update
42
+ - sudo apt-get -y --allow-downgrades install postgresql-$PGVERSION libpq5=$PGVERSION* libpq-dev=$PGVERSION*
43
43
  - export PATH=/usr/lib/postgresql/$PGVERSION/bin:$PATH
44
44
 
45
45
  script:
data/Gemfile CHANGED
@@ -11,4 +11,7 @@ group :development, :test do
11
11
  gem "rake-compiler-dock", "~> 1.0"
12
12
  gem "rdoc", "~> 6.4"
13
13
  gem "rspec", "~> 3.5"
14
+ # "bigdecimal" is a gem on ruby-3.4+ and it's optional for ruby-pg.
15
+ # Specs should succeed without it, but 4 examples are then excluded.
16
+ # gem "bigdecimal", "~> 3.0"
14
17
  end