Skip to content

Commit

Permalink
Fix wrong exception when running SQL while in #copy_data for output.
Browse files Browse the repository at this point in the history
It raised "undefined method `result_status' for nil:NilClass" previously
and raises "no COPY in progress" now.

This also fixes the failing test of the previous commit.
  • Loading branch information
larskanis committed Aug 20, 2016
1 parent 2e00f43 commit dd554c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions History.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Enhancements:
Bugfixes:
- Release GVL while calling PQsetClientEncoding(). #245
- Add __EXTENSIONS__ to Solaris/SmartOS for Ruby >= 2.3.x. #236
- Fix wrong exception when running SQL while in Connection#copy_data
block for output


== v0.18.4 [2015-11-13] Michael Granger <ged@FaerieMUD.org>
Expand Down
2 changes: 1 addition & 1 deletion lib/pg/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def copy_data( sql, coder=nil )
raise
else
res = get_last_result
if res.result_status != PGRES_COMMAND_OK
if !res || res.result_status != PGRES_COMMAND_OK
while get_copy_data
end
while get_result
Expand Down

0 comments on commit dd554c4

Please sign in to comment.