1
0
Fork 0

Check if cursor is none before checking rowcount.

This commit is contained in:
Amjith Ramanujam 2015-01-23 21:14:59 -08:00
parent 35909de751
commit e90f541033
1 changed files with 3 additions and 3 deletions

View File

@ -203,11 +203,11 @@ class PGCli(object):
logger.debug("status: %r", status)
start = time()
threshold = 1000
if is_select(status) and cur.rowcount > threshold:
if (is_select(status) and
cur and cur.rowcount > threshold):
click.secho('The result set has more than %s rows.'
% threshold, fg='red')
if not click.confirm('Do you want to continue?',
default=True):
if not click.confirm('Do you want to continue?'):
click.secho("Aborted!", err=True, fg='red')
break
output.extend(format_output(cur, headers, status))