Skip to content

Commit

Permalink
Add a new test for COPY'ing lots of data to the server
Browse files Browse the repository at this point in the history
This fails on Windows, since the introduction of #417
  • Loading branch information
larskanis committed Jan 28, 2022
1 parent 84aca71 commit 22e91a3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/pg/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,22 @@ def interrupt_thread(exc=nil)
expect( res.values ).to eq( [["1"], ["2"]] )
end

it "can process #copy_data input queries with lots of data" do
str = "abcd" * 2000 + "\n"
@conn.exec( "CREATE TEMP TABLE copytable2 (col1 TEXT)" )
@conn.copy_data( "COPY copytable2 FROM STDOUT" ) do |res|
1000.times do
@conn.put_copy_data(str)
end
end
expect( @conn ).to still_be_usable

res = @conn.exec( "SELECT COUNT(*) FROM copytable2" )
expect( res.values ).to eq( [["1000"]] )
res = @conn.exec( "SELECT * FROM copytable2 LIMIT 1" )
expect( res.values ).to eq( [[str.chomp]] )
end

it "can handle client errors in #copy_data for input" do
@conn.exec "ROLLBACK"
@conn.transaction do
Expand Down

0 comments on commit 22e91a3

Please sign in to comment.