Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove early return from set_cursor_tuple_fraction #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions lib/postgresql_cursor/cursor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,9 @@ def with_optional_transaction
# This is a value between 0.1 and 1.0 (PostgreSQL defaults to 0.1, this library defaults to 1.0)
# used to determine the expected fraction (percent) of result rows returned the the caller.
# This value determines the access path by the query planner.
def set_cursor_tuple_fraction(frac = 1.0)
@cursor_tuple_fraction ||= @options.fetch(:fraction, 1.0)
return @cursor_tuple_fraction if frac == @cursor_tuple_fraction
@cursor_tuple_fraction = frac
@result = @connection.execute("set cursor_tuple_fraction to #{frac}")
frac
def set_cursor_tuple_fraction
frac = @options.fetch(:fraction, 1.0)
@result = @connection.execute("set cursor_tuple_fraction to #{frac}")
end
end
end