summaryrefslogtreecommitdiff
blob: f9b7c1579a915b393e7f0e6ec9e4e162e30c4b5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# HG changeset patch
# User Lars Kanis <kanis@comcard.de>
# Date 1508756565 -7200
# Node ID fe63160e8a9803e257231d879fab2841ba44c37a
# Parent  d6d5533dfca85b618232fe3e9e56e59dbee99de6
Adjust tests for PostgreSQL-10

diff --git a/spec/helpers.rb b/spec/helpers.rb
--- a/spec/helpers.rb
+++ b/spec/helpers.rb
@@ -251,7 +251,7 @@
 
 	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
--- a/spec/pg/connection_spec.rb
+++ b/spec/pg/connection_spec.rb
@@ -232,7 +232,7 @@
 		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
@@ -1537,9 +1537,14 @@
 		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