58 lines
2.0 KiB
Diff
58 lines
2.0 KiB
Diff
|
From 55ca6dd8c1e0925f617b8f9e9042cbea01cf0eb8 Mon Sep 17 00:00:00 2001
|
||
|
From: Lars Kanis <kanis@comcard.de>
|
||
|
Date: Mon, 23 Oct 2017 13:02:45 +0200
|
||
|
Subject: [PATCH] Adjust tests for PostgreSQL-10
|
||
|
|
||
|
---
|
||
|
spec/helpers.rb | 2 +-
|
||
|
spec/pg/connection_spec.rb | 13 +++++++++----
|
||
|
2 files changed, 10 insertions(+), 5 deletions(-)
|
||
|
|
||
|
diff --git a/spec/helpers.rb b/spec/helpers.rb
|
||
|
index d13df5e..e9856de 100755
|
||
|
--- a/spec/helpers.rb
|
||
|
+++ b/spec/helpers.rb
|
||
|
@@ -251,7 +251,7 @@ module PG::TestingHelpers
|
||
|
|
||
|
def check_for_lingering_connections( conn )
|
||
|
conn.exec( "SELECT * FROM pg_stat_activity" ) do |res|
|
||
|
- conns = res.find_all {|row| row['pid'].to_i != conn.backend_pid }
|
||
|
+ conns = res.find_all {|row| row['pid'].to_i != conn.backend_pid && ["client backend", nil].include?(row["backend_type"]) }
|
||
|
unless conns.empty?
|
||
|
puts "Lingering connections remain:"
|
||
|
conns.each do |row|
|
||
|
diff --git a/spec/pg/connection_spec.rb b/spec/pg/connection_spec.rb
|
||
|
index d055673..0924ca4 100755
|
||
|
--- a/spec/pg/connection_spec.rb
|
||
|
+++ b/spec/pg/connection_spec.rb
|
||
|
@@ -219,7 +219,7 @@ describe PG::Connection do
|
||
|
described_class.connect(@conninfo).finish
|
||
|
sleep 0.5
|
||
|
res = @conn.exec(%[SELECT COUNT(*) AS n FROM pg_stat_activity
|
||
|
- WHERE usename IS NOT NULL])
|
||
|
+ WHERE usename IS NOT NULL AND application_name != ''])
|
||
|
# there's still the global @conn, but should be no more
|
||
|
expect( res[0]['n'] ).to eq( '1' )
|
||
|
end
|
||
|
@@ -1524,9 +1524,14 @@ describe PG::Connection do
|
||
|
end
|
||
|
|
||
|
it "shouldn't type map params unless requested" do
|
||
|
- expect{
|
||
|
- @conn.exec_params( "SELECT $1", [5] )
|
||
|
- }.to raise_error(PG::IndeterminateDatatype)
|
||
|
+ if @conn.server_version < 100000
|
||
|
+ expect{
|
||
|
+ @conn.exec_params( "SELECT $1", [5] )
|
||
|
+ }.to raise_error(PG::IndeterminateDatatype)
|
||
|
+ else
|
||
|
+ # PostgreSQL-10 maps to TEXT type (OID 25)
|
||
|
+ expect( @conn.exec_params( "SELECT $1", [5] ).ftype(0)).to eq(25)
|
||
|
+ end
|
||
|
end
|
||
|
|
||
|
it "should raise an error on invalid encoder to put_copy_data" do
|
||
|
--
|
||
|
2.14.3
|
||
|
|